-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Numbers lose precision #501
Labels
Comments
tsandall
added a commit
to tsandall/opa
that referenced
this issue
Mar 25, 2020
This commit replaces the existing PEG generated parser with a parser implemented by hand. The new parser is more efficient (avoiding old problems with pathological input cases like {{{{{{{{{}}}}}}}} and deeply-nested composites in general) and offers better opportunities for improved error reporting (which has been improved already but there is still room to grow.) During the test process of implementing the new parser, we identified a few issues that were present in the old parser. Those issues are fixed by this commit. Fixes open-policy-agent#1251 Fixes open-policy-agent#501 Fixes open-policy-agent#2198 Fixes open-policy-agent#2199 Fixes open-policy-agent#2200 Fixes open-policy-agent#2201 Fixes open-policy-agent#2202 Fixes open-policy-agent#2203 Co-authored-by: Torin Sandall <torinsandall@gmail.com> Co-authored-by: Patrick East <east.patrick@gmail.com> Signed-off-by: Torin Sandall <torinsandall@gmail.com> Signed-off-by: Patrick East <east.patrick@gmail.com>
tsandall
added a commit
that referenced
this issue
Mar 26, 2020
This commit replaces the existing PEG generated parser with a parser implemented by hand. The new parser is more efficient (avoiding old problems with pathological input cases like {{{{{{{{{}}}}}}}} and deeply-nested composites in general) and offers better opportunities for improved error reporting (which has been improved already but there is still room to grow.) During the test process of implementing the new parser, we identified a few issues that were present in the old parser. Those issues are fixed by this commit. Fixes #1251 Fixes #501 Fixes #2198 Fixes #2199 Fixes #2200 Fixes #2201 Fixes #2202 Fixes #2203 Co-authored-by: Torin Sandall <torinsandall@gmail.com> Co-authored-by: Patrick East <east.patrick@gmail.com> Signed-off-by: Torin Sandall <torinsandall@gmail.com> Signed-off-by: Patrick East <east.patrick@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider:
When querying this
euler.e
, we get2.718281828
, which is acceptable according to the JSON spec because implementations are free to limit “the range and precision of numbers accepted.”However, the spec goes on to say: “Since software that implements IEEE 754-2008 binary64 (double precision) numbers [IEEE754] is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision.”
So for interoperability, I’d expect more precision – possibly exactly IEEE754.
The text was updated successfully, but these errors were encountered: