Re: Variable type to hold largest whole number

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



John <John@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Which variable type (c#) can whole the largest whole number? I know this
sounds silly but as double and decimal are made for numbers with decimals I
am not sure.

Also if anybody knows of any library for .NET that would allow me to deal
with **VERY** large whole numbers.

Well, what are your restrictions? For instance, the range of double is
much greater than the range of decimal, and it will store a bigger
whole number - but it won't store *every* whole number within that
range accurately.

Decimal, however, can never become "inaccurate" at 0DP - in other
words, it will always accurately represent whole numbers, and it can
store any whole number within its range.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Quote from student, after teaching Pick
    ... you ask "why store what can be calculated?". ... We typically store Qty and Price. ... decimals places and then rounded for GST. ... cents whereas Card is exact and may even incur a further charge for using ...
    (comp.databases.pick)
  • Re: % stuff not calcing correctly?
    ... The fields I'm dealing with are in a subform that is set to Continuous. ... > decimals, you won't get the right answers. ... > Wayne Morgan ... Wayne - about not needing to store both values. ...
    (microsoft.public.access.formscoding)
  • Re: Reduce size of data
    ... AFAIK Jet stores Decimals like dBase does: no nibbles, ... digit, so at least 18 bytes for a decimal of precision 18. ... require 10 bytes to store (add one nibble for a sign and divide by two, ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Round off float value
    ... approach like want to store double value adjusted to two decimals. ... Reverse transformation is ... decimal currency, (Euro's and cents, Dollars and cents, etc) one ...
    (comp.lang.ruby)
  • Re: numeric values
    ... The whole POINT of a relational database is to remove the necessity to store ... Here you're setting up two tables and requiring that they ... That makes little or no sense to me - what business need is ... decimals and there are differences beyond what's visible on the screen - e.g. ...
    (microsoft.public.access.queries)