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

Rounding of large numbers inconsistent with google/jsonnet #186

Open
lihaoyi opened this issue Sep 14, 2023 · 0 comments
Open

Rounding of large numbers inconsistent with google/jsonnet #186

lihaoyi opened this issue Sep 14, 2023 · 0 comments

Comments

@lihaoyi
Copy link
Contributor

lihaoyi commented Sep 14, 2023

Input: 738529527931269425

  • google/jsonnet output: 738529527931269400 (according to https://jsonnet.org/)

    • equivalent to Javascript's parseFloat("738529527931269425")
  • databricks/sjsonnet output: 738529527931269376

    • equivalent to Java's (long)java.lang.Double.parseDouble("738529527931269425"), or BigInt(parseFloat("738529527931269425"))

It seems this is mostly an issue in the pretty-printing of floats: JS rounds a bit more than Java does, but in the end both are valid representations for the same double, and are bit-for-bit-identical and are == to each other on both Java and JS.

databricks/sjsonnet is meant to be identical to google/jsonnet, so even if this is an edge case we should probably follow suit

Initially reported in com-lihaoyi/upickle#522

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