diff options
Diffstat (limited to 'libgo/go/strconv/ftoa_test.go')
-rw-r--r-- | libgo/go/strconv/ftoa_test.go | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/libgo/go/strconv/ftoa_test.go b/libgo/go/strconv/ftoa_test.go index 1d3030b..755c986 100644 --- a/libgo/go/strconv/ftoa_test.go +++ b/libgo/go/strconv/ftoa_test.go @@ -30,9 +30,15 @@ var ftoatests = []ftoaTest{ {1, 'f', 5, "1.00000"}, {1, 'g', 5, "1"}, {1, 'g', -1, "1"}, + {1, 'x', -1, "0x1p+00"}, + {1, 'x', 5, "0x1.00000p+00"}, {20, 'g', -1, "20"}, + {20, 'x', -1, "0x1.4p+04"}, {1234567.8, 'g', -1, "1.2345678e+06"}, + {1234567.8, 'x', -1, "0x1.2d687cccccccdp+20"}, {200000, 'g', -1, "200000"}, + {200000, 'x', -1, "0x1.86ap+17"}, + {200000, 'X', -1, "0X1.86AP+17"}, {2000000, 'g', -1, "2e+06"}, // g conversion and zero suppression @@ -50,6 +56,7 @@ var ftoatests = []ftoaTest{ {0, 'f', 5, "0.00000"}, {0, 'g', 5, "0"}, {0, 'g', -1, "0"}, + {0, 'x', 5, "0x0.00000p+00"}, {-1, 'e', 5, "-1.00000e+00"}, {-1, 'f', 5, "-1.00000"}, @@ -100,7 +107,8 @@ var ftoatests = []ftoaTest{ {32, 'g', -1, "32"}, {32, 'g', 0, "3e+01"}, - {100, 'x', -1, "%x"}, + {100, 'x', -1, "0x1.9p+06"}, + {100, 'y', -1, "%y"}, {math.NaN(), 'g', -1, "NaN"}, {-math.NaN(), 'g', -1, "NaN"}, @@ -128,6 +136,27 @@ var ftoatests = []ftoaTest{ // Issue 2625. {383260575764816448, 'f', 0, "383260575764816448"}, {383260575764816448, 'g', -1, "3.8326057576481645e+17"}, + + // Issue 29491. + {498484681984085570, 'f', -1, "498484681984085570"}, + {-5.8339553793802237e+23, 'g', -1, "-5.8339553793802237e+23"}, + + // rounding + {2.275555555555555, 'x', -1, "0x1.23456789abcdep+01"}, + {2.275555555555555, 'x', 0, "0x1p+01"}, + {2.275555555555555, 'x', 2, "0x1.23p+01"}, + {2.275555555555555, 'x', 16, "0x1.23456789abcde000p+01"}, + {2.275555555555555, 'x', 21, "0x1.23456789abcde00000000p+01"}, + {2.2755555510520935, 'x', -1, "0x1.2345678p+01"}, + {2.2755555510520935, 'x', 6, "0x1.234568p+01"}, + {2.275555431842804, 'x', -1, "0x1.2345668p+01"}, + {2.275555431842804, 'x', 6, "0x1.234566p+01"}, + {3.999969482421875, 'x', -1, "0x1.ffffp+01"}, + {3.999969482421875, 'x', 4, "0x1.ffffp+01"}, + {3.999969482421875, 'x', 3, "0x1.000p+02"}, + {3.999969482421875, 'x', 2, "0x1.00p+02"}, + {3.999969482421875, 'x', 1, "0x1.0p+02"}, + {3.999969482421875, 'x', 0, "0x1p+02"}, } func TestFtoa(t *testing.T) { |