Open valderman opened 8 years ago
A related issue: trying to parse a Double >= 2^32 seems to wrap around, e.g. "9999999999" (ten 9s) gives 1410065407.0, which is (10^10 - 1) mod 2^32.
import Haste main = writeLog $ show $ (read $ show $ 10^10 - 1 :: Double)
In contrast, ghc prints "9.999999999e9" for the following program:
main = print (read $ show $ 10^10 - 1 :: Double)
As the topic says, certain valid floating point numbers (
Double
as well asFloat
) will causeread
to loop indefinitely. One such number is11111111111
(eleven ones), and another is2222222222
(ten twos; eleven twos work as expected however). Integral types don't seem to be affected, and reading the numbers to anInteger
and then converting them to aDouble
usingfromInteger
does not trigger the bug.The following code exhibits the bug: