[Haskell-cafe] Re: Is logBase right?
magnus at therning.org
Sun Aug 23 04:35:19 EDT 2009
2009/8/22 Roberto López <plastermoso at hotmail.com>:
> 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
> logBase 10 1000 :: Float
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.)
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus＠therning．org Jabber: magnus＠therning．org
http://therning.org/magnus identi.ca|twitter: magthe
More information about the Haskell-Cafe