truncate/floor with logBase

Thorsten Stocksmeier thorsten.stocksmeier@t-online.de
Mon, 30 Sep 2002 08:08:52 +0200


Hi Alastair,

thanks for your reply!

Main> floor (logBase 2 (fromInteger 32768)) -- should be == floor 15.0
> > 14
>
>Rounding error I suspect.
>
>Prelude> logBase 2 (fromInteger 32768) - 15.0
>-9.53674e-07

Okay, but is that my fault or hugs'?

Independent of that: Is there a workaround? Before logBase
I used log n / log 2 as a simulation of logBase 2. Still have
to find out whether this solves the problem. (well maybe
logBase *is* in fact log/log - must stick my nose into the
prelude this afternoon)

Sincerely,
Thorsten