diff --git a/src/strconv/atoc_test.go b/src/strconv/atoc_test.go index b77917ae16979d..e81b03a04370d5 100644 --- a/src/strconv/atoc_test.go +++ b/src/strconv/atoc_test.go @@ -153,16 +153,18 @@ func TestParseComplex(t *testing.T) { // ErrRange // next float64 - too large - {"1.7976931348623159e308+1.7976931348623159e308i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-1.7976931348623159e308-1.7976931348623159e308i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x1p1024+0x1p1024i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x1p1024-0x1p1024i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x2p1023+0x2p1023i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x2p1023-0x2p1023i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x.1p1028+0x.1p1028i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x.1p1028-0x.1p1028i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x.2p1027+0x.2p1027i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x.2p1027-0x.2p1027i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, + {"1.7976931348623159e308+1.7976931348623159e308i", infpp, ErrRange}, + {"-1.7976931348623159e308-1.7976931348623159e308i", infmm, ErrRange}, + {"0x1p1024+0x1p1024i", infpp, ErrRange}, + {"0x1p1024-0x1p1024i", infpm, ErrRange}, + {"-0x1p1024+0x1p1024i", infmp, ErrRange}, + {"-0x1p1024-0x1p1024i", infmm, ErrRange}, + {"0x2p1023+0x2p1023i", infpp, ErrRange}, + {"-0x2p1023-0x2p1023i", infmm, ErrRange}, + {"0x.1p1028+0x.1p1028i", infpp, ErrRange}, + {"-0x.1p1028-0x.1p1028i", infmm, ErrRange}, + {"0x.2p1027+0x.2p1027i", infpp, ErrRange}, + {"-0x.2p1027-0x.2p1027i", infmm, ErrRange}, // the border is ...158079 // borderline - okay @@ -171,20 +173,20 @@ func TestParseComplex(t *testing.T) { {"0x1.fffffffffffff7fffp1023+0x1.fffffffffffff7fffp1023i", 1.7976931348623157e+308 + 1.7976931348623157e+308i, nil}, {"-0x1.fffffffffffff7fffp1023-0x1.fffffffffffff7fffp1023i", -1.7976931348623157e+308 - 1.7976931348623157e+308i, nil}, // borderline - too large - {"1.797693134862315808e308+1.797693134862315808e308i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-1.797693134862315808e308-1.797693134862315808e308i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x1.fffffffffffff8p1023+0x1.fffffffffffff8p1023i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x1.fffffffffffff8p1023-0x1.fffffffffffff8p1023i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x1fffffffffffff.8p+971+0x1fffffffffffff.8p+971i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x1fffffffffffff8p+967-0x1fffffffffffff8p+967i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x.1fffffffffffff8p1027+0x.1fffffffffffff8p1027i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x.1fffffffffffff9p1027-0x.1fffffffffffff9p1027i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, + {"1.797693134862315808e308+1.797693134862315808e308i", infpp, ErrRange}, + {"-1.797693134862315808e308-1.797693134862315808e308i", infmm, ErrRange}, + {"0x1.fffffffffffff8p1023+0x1.fffffffffffff8p1023i", infpp, ErrRange}, + {"-0x1.fffffffffffff8p1023-0x1.fffffffffffff8p1023i", infmm, ErrRange}, + {"0x1fffffffffffff.8p+971+0x1fffffffffffff.8p+971i", infpp, ErrRange}, + {"-0x1fffffffffffff8p+967-0x1fffffffffffff8p+967i", infmm, ErrRange}, + {"0x.1fffffffffffff8p1027+0x.1fffffffffffff8p1027i", infpp, ErrRange}, + {"-0x.1fffffffffffff9p1027-0x.1fffffffffffff9p1027i", infmm, ErrRange}, // a little too large {"1e308+1e308i", 1e+308 + 1e+308i, nil}, - {"2e308+2e308i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"1e309+1e309i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"0x1p1025+0x1p1025i", complex(math.Inf(1), math.Inf(1)), ErrRange}, + {"2e308+2e308i", infpp, ErrRange}, + {"1e309+1e309i", infpp, ErrRange}, + {"0x1p1025+0x1p1025i", infpp, ErrRange}, {"2e308", complex(math.Inf(1), 0), ErrRange}, {"1e309", complex(math.Inf(1), 0), ErrRange}, {"0x1p1025", complex(math.Inf(1), 0), ErrRange}, @@ -193,28 +195,28 @@ func TestParseComplex(t *testing.T) { {"0x1p1025i", complex(0, math.Inf(1)), ErrRange}, // way too large - {"1e310+1e310i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-1e310-1e310i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"1e400+1e400i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-1e400-1e400i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"1e400000+1e400000i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-1e400000-1e400000i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"0x1p1030+0x1p1030i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"0x1p2000+0x1p2000i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"0x1p2000000000+0x1p2000000000i", complex(math.Inf(1), math.Inf(1)), ErrRange}, - {"-0x1p1030-0x1p1030i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"-0x1p2000-0x1p2000i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, - {"-0x1p2000000000-0x1p2000000000i", complex(math.Inf(-1), math.Inf(-1)), ErrRange}, + {"1e310+1e310i", infpp, ErrRange}, + {"-1e310-1e310i", infmm, ErrRange}, + {"1e400+1e400i", infpp, ErrRange}, + {"-1e400-1e400i", infmm, ErrRange}, + {"1e400000+1e400000i", infpp, ErrRange}, + {"-1e400000-1e400000i", infmm, ErrRange}, + {"0x1p1030+0x1p1030i", infpp, ErrRange}, + {"0x1p2000+0x1p2000i", infpp, ErrRange}, + {"0x1p2000000000+0x1p2000000000i", infpp, ErrRange}, + {"-0x1p1030-0x1p1030i", infmm, ErrRange}, + {"-0x1p2000-0x1p2000i", infmm, ErrRange}, + {"-0x1p2000000000-0x1p2000000000i", infmm, ErrRange}, // try to overflow exponent {"1e-4294967296+1e-4294967296i", 0, nil}, - {"1e+4294967296+1e+4294967296i", complex(math.Inf(1), math.Inf(1)), ErrRange}, + {"1e+4294967296+1e+4294967296i", infpp, ErrRange}, {"1e-18446744073709551616+1e-18446744073709551616i", 0, nil}, - {"1e+18446744073709551616+1e+18446744073709551616i", complex(math.Inf(1), math.Inf(1)), ErrRange}, + {"1e+18446744073709551616+1e+18446744073709551616i", infpp, ErrRange}, {"0x1p-4294967296+0x1p-4294967296i", 0, nil}, - {"0x1p+4294967296+0x1p+4294967296i", complex(math.Inf(1), math.Inf(1)), ErrRange}, + {"0x1p+4294967296+0x1p+4294967296i", infpp, ErrRange}, {"0x1p-18446744073709551616+0x1p-18446744073709551616i", 0, nil}, - {"0x1p+18446744073709551616+0x1p+18446744073709551616i", complex(math.Inf(1), math.Inf(1)), ErrRange}, + {"0x1p+18446744073709551616+0x1p+18446744073709551616i", infpp, ErrRange}, } for _, tt := range tests {