diff options
Diffstat (limited to 'libgo/go/math/atan2.go')
-rw-r--r-- | libgo/go/math/atan2.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libgo/go/math/atan2.go b/libgo/go/math/atan2.go index 02b045b9dc2..48ed9a986b8 100644 --- a/libgo/go/math/atan2.go +++ b/libgo/go/math/atan2.go @@ -35,11 +35,9 @@ func Atan2(y, x float64) float64 { } func atan2(y, x float64) float64 { - // TODO(rsc): Remove manual inlining of IsNaN, IsInf - // when compiler does it for us // special cases switch { - case y != y || x != x: // IsNaN(y) || IsNaN(x): + case IsNaN(y) || IsNaN(x): return NaN() case y == 0: if x >= 0 && !Signbit(x) { @@ -48,22 +46,22 @@ func atan2(y, x float64) float64 { return Copysign(Pi, y) case x == 0: return Copysign(Pi/2, y) - case x < -MaxFloat64 || x > MaxFloat64: // IsInf(x, 0): - if x > MaxFloat64 { // IsInf(x, 1) { + case IsInf(x, 0): + if IsInf(x, 1) { switch { - case y < -MaxFloat64 || y > MaxFloat64: // IsInf(y, -1) || IsInf(y, 1): + case IsInf(y, 0): return Copysign(Pi/4, y) default: return Copysign(0, y) } } switch { - case y < -MaxFloat64 || y > MaxFloat64: // IsInf(y, -1) || IsInf(y, 1): + case IsInf(y, 0): return Copysign(3*Pi/4, y) default: return Copysign(Pi, y) } - case y < -MaxFloat64 || y > MaxFloat64: //IsInf(y, 0): + case IsInf(y, 0): return Copysign(Pi/2, y) } |