Skip to content

Source code with large floating constants in exponential notation cannot be compiled

Source code cannot be compiled:

main = do
    print (123e124124124 :: Double)

where this one can be and will work after #5688 (closed) is fixed:

main = do
    print (read "123e124124124" :: Double)

Haskell Report forces Float and Double to go through Rational:

http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1360006.4.1

When exponent is big it produces very large Rational numbers. That takes a lot of time and usually ends in out of memory condition.

This is similar to #5688 (closed), but at compile time.

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