`read` doesn't work for floating point #354

Closed
emilaxelsson opened this Issue Dec 14, 2015 · 0 comments

Projects

None yet

1 participant

@emilaxelsson
Contributor

This program prints "1.5":

main = alert (show (read "1.2" :: Float))

(Same if I use Double.)

It seems to only affect certain numbers with an even decimal. This program

main
    = alert
    $ show
    $ [ read (show n) :: Float
        | n <- [1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7]
      ]

prints

[1.0, 1.1, 1.5, 1.3, 1.75, 1.5, 2.0, 1.7]
@valderman valderman closed this in abcd93c Dec 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment