Re: Variable type to hold largest whole number



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
.



Relevant Pages

  • Re: Larger field than thought?
    ... I need to generate automated account numbers for a new ... As I see it, I can change the above routine to check for 4 digits, instead ... Some form of loop to go through all parts in the database ... John W. Vinson/MVP ...
    (microsoft.public.access.tablesdbdesign)
  • question about the loves algorithm
    ... I have a somewhat practical and maybe silly question about the 'loves' algorithm. ... For each character in the word 'loves', count the total number of occurences in both names 'John' and 'Jane'. ... Then start adding subsequent digits until a 2 digit number is obtained, ...
    (sci.math)
  • Re: question about the loves algorithm
    ... I have a somewhat practical and maybe silly question about the 'loves' ... Let me explain first what the algorithm is. ... is John, and you like a girl named Jane. ... the number of digits seems to grow ...
    (sci.math)
  • Re: Formatted text field
    ... "John M" wrote in message ... > how is it possible to enable only numbers input in a jFormattedTextField? ... > I want that user can enter only digits. ... [This has some problems if the user types ...
    (comp.lang.java.programmer)