[freetds] patch: corrects the reading of large integer valueswhen represented as double
jluu at applia.fr
Wed May 19 14:05:56 EDT 2004
> IIRC, double precision is good only for 15 positions. Frediano once
> showed me how to examine the bit pattern, to know how precisely a number
> can be so represented. I'd like to be convinced that your 16th position
> is significant.
Here is the test case:
9e+15 is about the upper limit (try with 9100000000000010.0), therefore not
all 16 digit numbers can be represented, this is why 15 digit is remembered
as the "correct" value. However as you can see for the 16 digit numbers that
can be represented by a double, expressing then using 15 digits only leads
to information loss.
PS: the exact upper limit is a pattern of all ones in the mantissa ie
(2^53-1) that is 9007199254740991 (53 corresponding to the 52 bit mantissa +
the hidden bit).
More information about the FreeTDS