Skip to content
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
Closed

read doesn't work for floating point #354

emilaxelsson opened this issue Dec 14, 2015 · 0 comments

Comments

@emilaxelsson
Copy link
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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant