truncate/floor with logBase

Thorsten Stocksmeier <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
Hello,

consider the following:

Main> :version
-- Hugs Version February 2001
Main> logBase 2 (fromInteger 32768)  -- compute ld 2^15
15.0
Main> truncate 15.0
15
Main> floor 15.0
15
Main> floor (logBase 2 (fromInteger 32768))    -- should be == floor 15.0
14
Main> truncate (logBase 2 (fromInteger 32768)) -- should be == truncate 15.0
14

I can reproduce this with 8192 and 32768.

To cut it short: (truncate (logBase 2 (fromInteger 2^a))) != a ; a=13 & a=15

Looks a little weird to me, but I'm a Haskell beginner, so
possibly I just encountered an "It's not a bug, it's a feature"
situation here. Sorry if this is the case.

Thanks in advance,
Thorsten Stocksmeier
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.