Skip to content

encodeFloat 1 2047 = -1024.0

When the following code is compiled with optimization, it prints -1024.0, without optimization the result is Infinity.

main = print ((encodeFloat 1 2047) :: Double)

I think this might be caused by changes in decoding doubles in integer-gmp2. While decodeFloat is lossy, since we can not represent exceptional values, encodeFloat should never give a different answer here.

Also cgrun044 now gives a different result when compiled with optimization. It was broken anyway, since it claims some values are NaN, while actually Infinity is printed (also with 7.8), but it used to give the same answer regardless of optimization with GHC 7.8

Trac metadata
Trac field Value
Version 7.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information