[REBOL] Re: strange results with decimal!
From: rebol665:ifrance at: 10-Jan-2002 14:37
Decimal are store in IEEE format which is basically made of a binary
mantissa 0,xxxxxxxx and an exponent.
Converting decimal so binary leads to minor error.
To understand this try to convert 0,75 and 0,80 in binary.
0,75 is 0,11 in base two ( 0,1 + 0,01 or 0,5 + 0,25)
To understand this, you must remember that the comma moves to the right to
multiply by two ( 1 is 0,1 times two ). So 0,1 binary is 0,5 decimal. You
can use this to verify that 0,75 decimal is 0,11 binary. 0,11 binary with
two right moves gives 11 binary which is 3 decimal ( O,75 * 2 * 2 ).
If you try to do this with 0,80 you will find it never ends round because
you have to builds 0,8 decimal by addition of number like 0,5 0,25 0,125
0,0625 0,03125 etc.
So 0,8 in binary is like 1/3 in decimal