diff options
Diffstat (limited to 'src/pkg/math/pow.go')
-rw-r--r-- | src/pkg/math/pow.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/pkg/math/pow.go b/src/pkg/math/pow.go index f0f52c5cd..77af25648 100644 --- a/src/pkg/math/pow.go +++ b/src/pkg/math/pow.go @@ -36,8 +36,6 @@ func isOddInt(x float64) bool { // Pow(-Inf, y) = Pow(-0, -y) // Pow(x, y) = NaN for finite x < 0 and finite non-integer y func Pow(x, y float64) float64 { - // TODO(rsc): Remove manual inlining of IsNaN, IsInf - // when compiler does it for us switch { case y == 0 || x == 1: return 1 @@ -47,7 +45,7 @@ func Pow(x, y float64) float64 { return Sqrt(x) case y == -0.5: return 1 / Sqrt(x) - case x != x || y != y: // IsNaN(x) || IsNaN(y): + case IsNaN(x) || IsNaN(y): return NaN() case x == 0: switch { @@ -62,7 +60,7 @@ func Pow(x, y float64) float64 { } return 0 } - case y > MaxFloat64 || y < -MaxFloat64: // IsInf(y, 0): + case IsInf(y, 0): switch { case x == -1: return 1 @@ -71,7 +69,7 @@ func Pow(x, y float64) float64 { default: return Inf(1) } - case x > MaxFloat64 || x < -MaxFloat64: // IsInf(x, 0): + case IsInf(x, 0): if IsInf(x, -1) { return Pow(1/x, -y) // Pow(-0, -y) } |