LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package strconv_test | 5 package strconv_test |
6 | 6 |
7 import ( | 7 import ( |
8 "math" | 8 "math" |
9 . "strconv" | 9 . "strconv" |
10 "testing" | 10 "testing" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 // fixed bugs | 112 // fixed bugs |
113 {0.9, 'f', 1, "0.9"}, | 113 {0.9, 'f', 1, "0.9"}, |
114 {0.09, 'f', 1, "0.1"}, | 114 {0.09, 'f', 1, "0.1"}, |
115 {0.0999, 'f', 1, "0.1"}, | 115 {0.0999, 'f', 1, "0.1"}, |
116 {0.05, 'f', 1, "0.1"}, | 116 {0.05, 'f', 1, "0.1"}, |
117 {0.05, 'f', 0, "0"}, | 117 {0.05, 'f', 0, "0"}, |
118 {0.5, 'f', 1, "0.5"}, | 118 {0.5, 'f', 1, "0.5"}, |
119 {0.5, 'f', 0, "0"}, | 119 {0.5, 'f', 0, "0"}, |
120 {1.5, 'f', 0, "2"}, | 120 {1.5, 'f', 0, "2"}, |
121 » | 121 |
122 // http://www.exploringbinary.com/java-hangs-when-converting-2-225073858
5072012e-308/ | 122 // http://www.exploringbinary.com/java-hangs-when-converting-2-225073858
5072012e-308/ |
123 {2.2250738585072012e-308, 'g', -1, "2.2250738585072014e-308"}, | 123 {2.2250738585072012e-308, 'g', -1, "2.2250738585072014e-308"}, |
124 // TODO: uncomment after fixing issue 1463. | 124 // TODO: uncomment after fixing issue 1463. |
125 // http://www.exploringbinary.com/php-hangs-on-numeric-value-2-225073858
5072011e-308/ | 125 // http://www.exploringbinary.com/php-hangs-on-numeric-value-2-225073858
5072011e-308/ |
126 // {2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"}, | 126 // {2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"}, |
127 } | 127 } |
128 | 128 |
129 func TestFtoa(t *testing.T) { | 129 func TestFtoa(t *testing.T) { |
130 for i := 0; i < len(ftoatests); i++ { | 130 for i := 0; i < len(ftoatests); i++ { |
131 test := &ftoatests[i] | 131 test := &ftoatests[i] |
(...skipping 10 matching lines...) Expand all Loading... |
142 if s != test.s { | 142 if s != test.s { |
143 t.Error("test32", test.f, string(test.fmt), test
.prec, "want", test.s, "got", s) | 143 t.Error("test32", test.f, string(test.fmt), test
.prec, "want", test.s, "got", s) |
144 } | 144 } |
145 s = FtoaN(test.f, test.fmt, test.prec, 32) | 145 s = FtoaN(test.f, test.fmt, test.prec, 32) |
146 if s != test.s { | 146 if s != test.s { |
147 t.Error("testN=32", test.f, string(test.fmt), te
st.prec, "want", test.s, "got", s) | 147 t.Error("testN=32", test.f, string(test.fmt), te
st.prec, "want", test.s, "got", s) |
148 } | 148 } |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
LEFT | RIGHT |