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

[BUG] TokenNumericValidator doesn't support scientific notation #128

Open
wkoder opened this issue Sep 11, 2023 · 0 comments
Open

[BUG] TokenNumericValidator doesn't support scientific notation #128

wkoder opened this issue Sep 11, 2023 · 0 comments

Comments

@wkoder
Copy link

wkoder commented Sep 11, 2023

Context in Spanish on the omegaUp side here.

Currently, TokenNumericValidator doesn't even accept E as part of a double, so it just ignores tokens with doubles in scientific notation. This is troublesome for problems using this validator because they usually ask for "full precision", and adding any formatting to the output introduces rounding errors and problem solvers don't know with what precision they should print them out with, and languages like C/C++ and Java just use scientific notation in the output when they see fit.

This all means that 1E-9 != 0.000000001, for example, which is not acceptable.

A possible solution is to:

  • Accept both e and E here.
  • Take both e and E into account here
  • Also take the possibility of an extra - after the Es
  • Consider just appending to a string and finally parsing it with Scala's built-ins
  • Test various cases here
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