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 produces "Ok NaN" for some inputs #919
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Nov 13, 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
Nov 13, 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.
zwilias
Nov 13, 2017
Member
+ and - are covered by #834; 0x is one I hadn't heard about; but also seems fixable. That toInt implementation is starting to become pretty gnarly.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Mar 7, 2018
Member
@zwilias, it sounds like some of this is resolved. If there is any left, open a new one with the relevant SSCCEs so I can figure out what is actually broken at the moment!
|
@zwilias, it sounds like some of this is resolved. If there is any left, open a new one with the relevant SSCCEs so I can figure out what is actually broken at the moment! |
evancz
closed this
Mar 7, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
https://github.com/elm-lang/core/issues/949 SSCCE/overview created |
TobiDo commentedNov 13, 2017
String.toIntresults toOk NaNfor the arguments"+","-","0x"respectively.See Ellie: https://ellie-app.com/mjSxjQHdka1/1
Here is the implementation of
toIntfrom Elm/Kernel/String.js:I think the best solution would be to check whether
parseIntreturnedNaNbefore returning an Ok-Result. One could, of course, also handle the three aforementioned cases explicitly.