Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upString.toInt returns a Float in certain circumstances #831
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Feb 2, 2017
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
process-bot
commented
Feb 2, 2017
|
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Feb 2, 2017
Contributor
There do exist other operations in current Elm that produce NaN despite being typed Int. See https://github.com/elm-lang/core/issues/590, covered in https://github.com/elm-lang/core/issues/721.
Also, it would be pretty important that you not only specify which version of Elm you use, but also which version of the core library you use. Because the implementation of String.toInt was recently changed, see https://github.com/elm-lang/core/releases/tag/5.1.0.
|
There do exist other operations in current Elm that produce Also, it would be pretty important that you not only specify which version of Elm you use, but also which version of the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This issue reproduces in 0.18.0/5.1.1. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Yeah, I'm using Elm 0.18 and elm-core 5.1.1. |
ChrisWellsWood
referenced this issue
Feb 3, 2017
Merged
Added extra condition to stop '-' or '+' returning a `Float` from `String.toInt`. #834
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Fixed by OP in #834 |
ChrisWellsWood commentedFeb 2, 2017
•
edited
Edited 1 time
-
ChrisWellsWood
edited Feb 2, 2017 (most recent)
I was doing some validation on input, and noticed an odd situation when parsing strings:
But the type of
NaNisFloat, notInt. I've not found any other circumstances where this occurs yet. I have a work around where I catch it manually, but I have to usetoFloaton it first in order to useisNaN.I'm using Elm 0.18, on FireFox and Elm repl. Thanks!