]> Cypherpunks repositories - gostls13.git/commitdiff
strconv: add test that trips up other implementations
authorRuss Cox <rsc@golang.org>
Tue, 1 Feb 2011 17:48:18 +0000 (12:48 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 1 Feb 2011 17:48:18 +0000 (12:48 -0500)
R=r, gri1
CC=golang-dev
https://golang.org/cl/4092045

src/pkg/strconv/atof_test.go
src/pkg/strconv/ftoa_test.go

index 6cc60e549da97003f66c2d933077be319c6fa028..6d8396ee73baa6e088f9491d82dbbcc41b23e2e1 100644 (file)
@@ -103,6 +103,11 @@ var atoftests = []atofTest{
        {"1e", "0", os.EINVAL},
        {"1e-", "0", os.EINVAL},
        {".e-1", "0", os.EINVAL},
+
+       // http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
+       {"2.2250738585072012e-308", "2.2250738585072014e-308", nil},
+       // http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
+       {"2.2250738585072011e-308", "2.225073858507201e-308", nil},
 }
 
 func init() {
index 3a862a2beeb895655166e758c6ab4d8a57f30257..bc327600e18b017f0541cd3b362d63c412dad297 100644 (file)
@@ -118,6 +118,12 @@ var ftoatests = []ftoaTest{
        {0.5, 'f', 1, "0.5"},
        {0.5, 'f', 0, "0"},
        {1.5, 'f', 0, "2"},
+
+       // http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
+       {2.2250738585072012e-308, 'g', -1, "2.2250738585072014e-308"},
+       // TODO: uncomment after fixing issue 1463.
+       // http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
+       // {2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"},
 }
 
 func TestFtoa(t *testing.T) {