diff options
Diffstat (limited to 'src/pkg/math/exp.go')
| -rw-r--r-- | src/pkg/math/exp.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/math/exp.go b/src/pkg/math/exp.go index 9ad2b3877..bc02fda10 100644 --- a/src/pkg/math/exp.go +++ b/src/pkg/math/exp.go @@ -104,11 +104,13 @@ func Exp(x float64) float64 { NearZero = 1.0 / (1 << 28) // 2^-28 ) + // TODO(rsc): Remove manual inlining of IsNaN, IsInf + // when compiler does it for us // special cases switch { - case IsNaN(x) || IsInf(x, 1): + case x != x || x > MaxFloat64: // IsNaN(x) || IsInf(x, 1): return x - case IsInf(x, -1): + case x < -MaxFloat64: // IsInf(x, -1): return 0 case x > Overflow: return Inf(1) |
