Fix etc__high_prec_dec__to_f64 shift amount

Shifting 0.299 left by 2 doesn't put us in [½ .. 1].
This commit is contained in:
Nigel Tao committed 2020-09-08 16:43:31 +10:00
1 parent 1210340e75
commit 57d47c633c
5 files changed
+37 -14

No files matched your search

+21
View File
@@ -1005,6 +1005,8 @@ test_wuffs_strconv_parse_number_f64_regular() {
{.want = 0x4038000000000000, .str = "24"},
{.want = 0x4038000000000000, .str = "2400_00000_00000.00000_e-_1_2"},
{.want = 0x40FE240C9FCB0C02, .str = "123456.789012"},
{.want = 0x41E0246690000001,
.str = "2.16656806400000023841857910156251e9"},
{.want = 0x4202A05F20000000, .str = "1e10"},
{.want = 0x4330000000000000, .str = "4503599627370496"}, // 1 << 52.
{.want = 0x4330000000000000, .str = "4503599627370496.5"},
@@ -1020,6 +1022,7 @@ test_wuffs_strconv_parse_number_f64_regular() {
{.want = 0x4340000000000002, .str = "9007199254740996"},
{.want = 0x4340000000000002, .str = "9_007__199_254__740_996"},
{.want = 0x4370000000000000, .str = "7.2057594037927933e+16"},
{.want = 0x43F002F1776DDA67, .str = "18459999196907202592"},
{.want = 0x4415AF1D78B58C40, .str = "1e20"},
{.want = 0x44B52D02C7E14AF6, .str = "1e23"},
{.want = 0x46293E5939A08CEA, .str = "1e30"},
@@ -1655,6 +1658,15 @@ test_wuffs_strconv_render_number_f64() {
.want_3f = "123456.789",
.want_4g = "1.235e+05",
},
{
.x = 0x41E0246690000001,
.want__e = "2.1665680640000005e+09",
.want__f = "2166568064.0000005",
.want_0g = "2e+09",
.want_2e = "2.17e+09",
.want_3f = "2166568064.000",
.want_4g = "2.167e+09",
},
{
.x = 0x4202A05F20000000,
.want__e = "1e+10",
@@ -1745,6 +1757,15 @@ test_wuffs_strconv_render_number_f64() {
.want_3f = "72057594037927936.000",
.want_4g = "7.206e+16",
},
{
.x = 0x43F002F1776DDA67,
.want__e = "1.8459999196907205e+19",
.want__f = "18459999196907205000",
.want_0g = "2e+19",
.want_2e = "1.85e+19",
.want_3f = "18459999196907204608.000",
.want_4g = "1.846e+19",
},
{
.x = 0x4415AF1D78B58C40,
.want__e = "1e+20",