New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
1 participant
@emilaxelsson
Contributor

emilaxelsson commented Dec 14, 2015

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