This repository was archived by the owner on Dec 1, 2023. It is now read-only.
Commit f54a823
committed
decrease rounding error when parsing f64 from JSON
As the precision of a floating point number depends
on its magnitude, adding each fractional digit to a large
number accumulates the floating point error quite quickly.
The error is accumulated much slower when assembling
the fractional part separately and then finally adding it
to the large number. Vide: the added test cases.1 parent 563fc46 commit f54a823
1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1581 | 1581 | | |
1582 | 1582 | | |
1583 | 1583 | | |
| 1584 | + | |
1584 | 1585 | | |
1585 | 1586 | | |
1586 | 1587 | | |
1587 | 1588 | | |
1588 | | - | |
| 1589 | + | |
1589 | 1590 | | |
1590 | 1591 | | |
1591 | 1592 | | |
1592 | 1593 | | |
1593 | 1594 | | |
1594 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
1595 | 1598 | | |
1596 | 1599 | | |
1597 | 1600 | | |
| |||
2945 | 2948 | | |
2946 | 2949 | | |
2947 | 2950 | | |
| 2951 | + | |
2948 | 2952 | | |
2949 | 2953 | | |
2950 | 2954 | | |
| |||
2975 | 2979 | | |
2976 | 2980 | | |
2977 | 2981 | | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
2978 | 2985 | | |
2979 | 2986 | | |
2980 | 2987 | | |
| |||
0 commit comments