math: more special cases for signed zero
R=rsc
CC=golang-dev
https://golang.org/cl/937042
diff --git a/src/pkg/math/ldexp.go b/src/pkg/math/ldexp.go
index ab8392a..d04bf15 100644
--- a/src/pkg/math/ldexp.go
+++ b/src/pkg/math/ldexp.go
@@ -10,7 +10,10 @@
// TODO(rsc): Remove manual inlining of IsNaN, IsInf
// when compiler does it for us
// special cases
- if frac != frac { // IsNaN(frac)
+ switch {
+ case frac == 0:
+ return frac // correctly return -0
+ case frac != frac: // IsNaN(frac):
return NaN()
}
x := Float64bits(frac)