Skip to content

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

@wkoder

Description

@wkoder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions