summaryrefslogtreecommitdiff
path: root/src/pkg/strconv
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/strconv')
-rw-r--r--src/pkg/strconv/ftoa.go2
-rw-r--r--src/pkg/strconv/ftoa_test.go3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/pkg/strconv/ftoa.go b/src/pkg/strconv/ftoa.go
index 4ec3cdbb9..b6049c545 100644
--- a/src/pkg/strconv/ftoa.go
+++ b/src/pkg/strconv/ftoa.go
@@ -64,7 +64,7 @@ func FtoaN(f float64, fmt byte, prec int, n int) string {
}
func genericFtoa(bits uint64, fmt byte, prec int, flt *floatInfo) string {
- neg := bits>>flt.expbits>>flt.mantbits != 0
+ neg := bits>>(flt.expbits+flt.mantbits) != 0
exp := int(bits>>flt.mantbits) & (1<<flt.expbits - 1)
mant := bits & (uint64(1)<<flt.mantbits - 1)
diff --git a/src/pkg/strconv/ftoa_test.go b/src/pkg/strconv/ftoa_test.go
index bc327600e..6d361a138 100644
--- a/src/pkg/strconv/ftoa_test.go
+++ b/src/pkg/strconv/ftoa_test.go
@@ -121,9 +121,8 @@ var ftoatests = []ftoaTest{
// 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"},
+ {2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"},
}
func TestFtoa(t *testing.T) {