You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello:
I want to use JSON to read the 18 digit numbers generated by the snowflake algorithm, but I encountered an accuracy loss issue after reading, as follows {'a':738529527931269425}
But after I ran it, I showed the following results: {"a":738529527931269376}
The running result shows incorrect numbers, missing is accuracy. If I want to fully obtain this number without converting it to a string, is there a solution?
Note: This issue has been encountered while running sjsonnet. Preliminary troubleshooting may be in this project, and we hope the author can help solve it.
Thank you very much!
The text was updated successfully, but these errors were encountered:
Sjsonnet works with a Javascript data model. That means double precision floating point numbers. There really isn't anything we can do here: Even if uPickle is able to read the raw JSON number as a full un-truncated string, Sjsonnet does not, and
It's unlikely we can use a different number representation for Sjsonnet, due to performance considerations: BigDecimals are orders of magnitude slower and more memory-intensive than Doubles, and Sjsonnet is somewhat performance sensitive (perf is it's raison d'etre for existing)
databricks/sjsonnet is meant to be equivalent to google/jsonnet, and google/jsonnet also truncates long numbers. It truncates your example differently - which is its own issue I've opened as Rounding of large numbers inconsistent with google/jsonnet databricks/sjsonnet#186 - but it still truncates it, so your use case is not supported on any implementation of the Jsonnet language
You'll have to wrap your long numbers it in a string, or use a different configuration language that uses arbitrary precision numbers
Hello:
I want to use JSON to read the 18 digit numbers generated by the snowflake algorithm, but I encountered an accuracy loss issue after reading, as follows
{'a':738529527931269425}
But after I ran it, I showed the following results:
{"a":738529527931269376}
The running result shows incorrect numbers, missing is accuracy. If I want to fully obtain this number without converting it to a string, is there a solution?
Note: This issue has been encountered while running sjsonnet. Preliminary troubleshooting may be in this project, and we hope the author can help solve it.
Thank you very much!
The text was updated successfully, but these errors were encountered: