diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-02-29 11:23:13 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-02-29 11:23:13 +0100 |
| commit | b6d7097a0d6072199f2cd74d67404890697cf78a (patch) | |
| tree | a2193c528a79fd5606507568859ee5067c6b86e4 /src/pkg/math/exp.go | |
| parent | 4cecda6c347bd6902b960c6a35a967add7070b0d (diff) | |
| download | golang-b6d7097a0d6072199f2cd74d67404890697cf78a.tar.gz | |
Imported Upstream version 2012.02.22upstream-weekly/2012.02.22
Diffstat (limited to 'src/pkg/math/exp.go')
| -rw-r--r-- | src/pkg/math/exp.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/pkg/math/exp.go b/src/pkg/math/exp.go index 2a1710a6d..f31585fa7 100644 --- a/src/pkg/math/exp.go +++ b/src/pkg/math/exp.go @@ -100,13 +100,11 @@ 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 x != x || x > MaxFloat64: // IsNaN(x) || IsInf(x, 1): + case IsNaN(x) || IsInf(x, 1): return x - case x < -MaxFloat64: // IsInf(x, -1): + case IsInf(x, -1): return 0 case x > Overflow: return Inf(1) @@ -145,13 +143,11 @@ func exp2(x float64) float64 { Underflow = -1.0740e+03 ) - // TODO: remove manual inlining of IsNaN and IsInf - // when compiler does it for us // special cases switch { - case x != x || x > MaxFloat64: // IsNaN(x) || IsInf(x, 1): + case IsNaN(x) || IsInf(x, 1): return x - case x < -MaxFloat64: // IsInf(x, -1): + case IsInf(x, -1): return 0 case x > Overflow: return Inf(1) |
