[Haskell-cafe] fun fact: value of truncate -Infinity depends on optimisation level

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Sun Jul 26 12:45:05 UTC 2015


Just for general amusement -

I was debugging very strange behaviour
in a straightforward deterministic program,
where the output value seemed to depend on ghc's optimization level.

Well, it turned out that I (accidentally) computed
truncate (logBase 2 0) :: Int,
and that's  0  with -O0, but  -9223372036854775808  with -O2.

https://github.com/jwaldmann/matchbox/issues/19


More information about the Haskell-Cafe mailing list