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

Doubles in hex notation fail to parse #3348

Closed
martijnhoekstra opened this issue Apr 24, 2018 · 5 comments
Closed

Doubles in hex notation fail to parse #3348

martijnhoekstra opened this issue Apr 24, 2018 · 5 comments
Assignees
Labels
bug Confirmed bug. Needs to be fixed.
Milestone

Comments

@martijnhoekstra
Copy link

reproducer:

scala.util.Try("0x0p1".toDouble)

expected:

Success(0.0)

actual:

Failure(java.lang.NumberFormatException: For input string: "0x0p1")

@martijnhoekstra martijnhoekstra changed the title doubles in hex notation aren't recognized doubles in hex notation fail to parse Apr 24, 2018
@sjrd sjrd changed the title doubles in hex notation fail to parse Doubles in hex notation fail to parse Apr 24, 2018
@sjrd sjrd added the bug Confirmed bug. Needs to be fixed. label Apr 24, 2018
@sjrd
Copy link
Member

sjrd commented Apr 24, 2018

Thanks for the report. There is no fundamental reason that this should not be supported.

@sjrd
Copy link
Member

sjrd commented May 21, 2018

This is trickier than it looks. Wip here: 0.6.x...sjrd:parse-double-hex
Needs more tests.

@sjrd sjrd self-assigned this May 22, 2018
@sjrd sjrd added this to the v0.6.24 milestone May 22, 2018
sjrd added a commit to sjrd/scala-js that referenced this issue May 22, 2018
Since Float.parseFloat delegates to Double.parseDouble, we
trivially get that one for free.
sjrd added a commit to sjrd/scala-js that referenced this issue May 22, 2018
Since Float.parseFloat delegates to Double.parseDouble, we
trivially get that one for free.
sjrd added a commit to sjrd/scala-js that referenced this issue May 22, 2018
Since Float.parseFloat delegates to Double.parseDouble, we
trivially get that one for free.
@martijnhoekstra
Copy link
Author

There is a bunch of test cases in Apache Harmony which you could consider grabbing.

@sjrd
Copy link
Member

sjrd commented May 23, 2018

I have stopped looking at Harmony to be as independent as possible license-wise. I generated random test cases on the JVM, so now I've enough of them.

sjrd added a commit that referenced this issue May 23, 2018
Fix #3348: Support hexadecimal notation in Double.parseDouble.
@sjrd
Copy link
Member

sjrd commented May 23, 2018

Fixed in 2175de9.

@sjrd sjrd closed this as completed May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug. Needs to be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants