
23 Aug
2009
23 Aug
'09
8:35 a.m.
2009/8/22 Roberto López
If 4.0 / 2.0 was 1.9999999999999999999998, it would be ok?
The real value of log10 1000 is 3 (3.0). It can be represented with accuracy and it should be.
Well, it already can be, you just need to choose your representation properly:
logBase 10 1000 :: Double 2.9999999999999996 logBase 10 1000 :: Float 3.0
Welcome the wonderful land of floating point numbers. (The examples above are from an Intel 32-bit machine, I suspect it'd change on any other type of architecture.) /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe