-
Notifications
You must be signed in to change notification settings - Fork 22
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
Only convert Scientific to Integer for nonnegative exponents #29
Conversation
I should add that another option is to check whether the input expression is in scientific notation, and decide based on that, rather than depending on the actual value. In the version implemented in this PR, an input value of, say, I leave it up to the reviewer to make a decision on this. |
…sion (#4741) Fixes #4733. See also hasura/graphql-parser-hs#29.
…sion (#4741) Fixes #4733. See also hasura/graphql-parser-hs#29.
We use attoparsec's scientific number parsing code, which gives us a
Scientific
value. We like to work withInteger
s when we can, and so we sometimes convert this scientific number to an integer by simply taking its floor. But simply checking if the input text has a period symbol.
in it does not suffice to check for correctness of this conversion, as numbers with a negative exponent may not be integral. This fixes that to only store numbers as integers if they have been supplied with a nonnegative exponent.hasura/graphql-engine#4733 will be fixed by this (after we update the version of graphql-parser-hs used there).