Re: double with precision



Roy Gourgi schrieb:

Thanks Eric,

Just out of curiosity why can't the number 1.74 be represented exactly with a double?
Java internally stores doubles as a sum of powers of 2 (1, 0.5, 0.25, 0.125, ...). Fractionizing of 1.74 yields
1.74 = 1 * 1
+ 1 * 0.5
+ 0 * 0.25
+ 1 * 0.125
+ 1 * 0.0625
+ 1 * 0.03125
...
which is a never ending series.

--
Thomas
.