On Jun 30, 2008, at 2:02 PM, Markus Winter wrote:
I think a double should easily hold a 20 digit number. Otherwise it
would be
the worst implementation in any programming language ever.
Markus,
You have to remember that with a 8 byte floating point number only 53
bits of the 64 bits hold the digits of the number. 11 bits are needed
to hold the exponent of the number. Because of this an 8 byte UInt64
value can return more digits than an 8 byte, double, floating point
number. However, the floating point exponent can take you out to
powers of 308 or something like that which gives much larger numbers
than integer can represent; but, you have a limit of 17 digits in a
double.
Here is a good article that explains some of the oddities of floating
point number. The author is primarily discussing 4 byte, single,
floating point in Fortran but the same thing is going on in RB with
floating point numbers. This same article also gives good examples of
why floating point arithmetic can lead to unexpected problems if you
have no understanding of what is going on internally.
http://www.lahey.com/float.htm
=== A Mac addict in Tennessee ===
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|