In article <84*************************@posting.google.com> ,
Old Wolf <ol*****@inspire.net.nz> wrote:
"John Harrison" <jo*************@hotmail.com> wrote:
Some floating point numbers are exact. Any integral number is exact,
I thought this was implementation-dependent. On the only floating point
implementation I've ever looked at closely, integral numbers were not
exact unless they were powers of two. (They were stored as 0 <= m < 1
and integer e, and the value was m * 2^e)
Also, some a-priori reasoning: on my system DBL_MAX is
1797693134862315708145274237317043567980705675258 4499659891747680
3157260780028538760589558632766878171540458953514 3824642343213268
8946418276846754670353751698604991057655128207624 5490090389328944
0758685084551339423045832369032229481658085593321 2334827479782620
41447231687381771809192998812504040261841248583 68
If integral numbers were exact then 'double' would have to have
1024 bits (approximately), but on my system, 'double' is 64 bits.
Let me rephrase Mr Harrison's answer.
Any integral number that can be represented in no more bits than the
mantissa is represented exactly. For IEEE double precision with 64 bits,
the mantissa is 53 bits long, it is capable of representing exactly any
integer value that has an absolute value less than or equal to 2^53 - 1
or 9,007,199,254,740,991 for any value larger than that, the value stored
is exact. However, not all values may be stored. For example, you may store
9,007,199,254,740,992 or 9,007,199,254,740,994, but not 9,007,199,254,740,993.