[Haskell-cafe] Is logBase right?

Eugene Kirpichov ekirpichov at gmail.com
Sat Aug 22 04:02:20 EDT 2009


What do you consider to be the specification of logBase? Exact
floating-point numbers don't exist, so it has to return an
approximation. The standard doesn't give any guarantees as to the
precision of the approximation. Is a precision of 0.00000000000004 not
satisfactory for you?

2009/8/21 Roberto <plastermoso at hotmail.com>:
> 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
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list