[Haskell-cafe] Is logBase right?

Mark Wotton mwotton at gmail.com
Sat Aug 22 04:02:51 EDT 2009


he who compares floating point numbers for equality is in a state of  
sin.

mark

On 22/08/2009, at 5:00 AM, Roberto wrote:

> Hi,
>
> There is a mistake is logBase:
>
> $ ghci
> GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer ... linking ... done.
> Loading package base ... linking ... done.
> Prelude> logBase 10 10
> 1.0
> Prelude> logBase 10 100
> 2.0
> Prelude> logBase 10 1000
> 2.9999999999999996                  <--- eeeerrgghhhh!
> Prelude> logBase 10 10000
> 4.0
>
>
> My host is a Debian GNU/Linux 5.0.2 (lenny) with the following GHC  
> packages:
>
> ii  ghc6                                 6.10.4-1
> ii  ghc6-doc                             6.10.4-1
> ii  libghc6-mtl-dev                      1.1.0.2-7+b1
> ii  libghc6-utf8-string-dev              0.3.5-1+b1
> ii  libghc6-x11-dev                      1.4.5-6
> rc  libghc6-x11-doc                      1.4.2-1
> ii  libghc6-x11-xft-dev                  0.3-3+b3
> ii  libghc6-xmonad-contrib-dev           0.8.1-3+b3
> rc  libghc6-xmonad-contrib-doc           0.8-2
> ii  libghc6-xmonad-dev                   0.8.1-5
>
> Regards!
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list