Re: Variable type to hold largest whole number
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Thu, 19 Oct 2006 23:09:40 +0100
John <John@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
By whole number I mean: A number that doesn't contain a fraction, so not too
sure what you mean by "can never become 'inaccurate' " basically I am trying
to write a program that finds primary numbers I have been told that once I
reach the limit of what a variable type can hold and lets say add 1, it
doesn?t through an error it just provides me with an incorrect "random"
number.
Well, it won't provide you with a random number, but a whole number
stored in a double + 1 may well not give you a whole number - and the
next exactly representable integer may well be significantly more.
Thus why I want to find out what is the best variable type to for
this project (find primary numbers) and also know what the limitations are
within the .net framework for very long numbers and whether there are any
special classes (free or commercial to hold very large numbers
hundred/thousands of digits).
If you want to go above 28 digits, you'll need to use a 3rd party class
- otherwise Decimal should be okay for you.
http://www.codeproject.com/csharp/biginteger.asp may be of interest to
you.
--
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
.
- References:
- Re: Variable type to hold largest whole number
- From: Jon Skeet [C# MVP]
- Re: Variable type to hold largest whole number
- Prev by Date: Re: Accessing Properties?
- Next by Date: Re: Virus scannnig document before saving to database
- Previous by thread: Re: Variable type to hold largest whole number
- Next by thread: Crystal Reports - Average of two fields
- Index(es):
Relevant Pages
|