-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JSON: Fix complex64 encoding precision (#1011)
Converting `complex64` to `complex128` meant that the real and imaginary components of the `complex64` value were encoded as `float64` values which, similar to #1002, encoded them with incorrect precision. Fix this by adding a precision parameter during encoding to specify the precision with which the components should be encoded. Guard against other such cases where there's loss of precision by adding tests for several such corner cases for complex, float, int, and uint. This has no significant performance impact on my laptop. (The drop is likely a false positive.) ``` name old time/op new time/op delta ZapJSONFloat32AndComplex64-4 491ns ±22% 442ns ± 6% -10.00% (p=0.000 n=9+9) ``` Fixes #1010
- Loading branch information
Showing
4 changed files
with
69 additions
and
27 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
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