-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(library/vm/vm_json): avoid overflow and maximize precision in jso…
…n serialization (#743) The original code for reading integers from the json would truncate large integers. This now ensures that no precision is lost converting between the `json` C++ API and the lean API. This now also uses `uint64_t` or `int64_t` to write Lean integers into json if possible, choosing whichever the lean integer fits in. Unfortunately our json library does not support big integers, so overflow into inexact floats is unavoidable for larger integers. This probably is made worse by the fact that we don't have a `native.double`, so the precision loss can be quite significant. This also adds a `json.decidable_eq` instance, since it's useful in the tests and I needed it in downstream tests too. Alternative to #740. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
- Loading branch information
1 parent
84516f9
commit a17a192
Showing
3 changed files
with
73 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters