summaryrefslogtreecommitdiff
path: root/src/math/expm1.go
diff options
context:
space:
mode:
authorCharlie Dorian <cldorian@gmail.com>2015-06-30 20:14:30 -0400
committerIan Lance Taylor <iant@golang.org>2015-07-10 22:22:24 +0000
commit8b221092b9a9664918c28a76b109786956e0057d (patch)
tree5d7e2ae49489ef8bf20d0e4b1f0f530c5ebe00e5 /src/math/expm1.go
parent1082e2390e55519a576f21c0424f41246d232808 (diff)
downloadgo-git-8b221092b9a9664918c28a76b109786956e0057d.tar.gz
math: Expm1 returns -1 with large negative argument.
Fixes #11442 Change-Id: I2053fe752c6a122924d28565f1338f73e00ed417 Reviewed-on: https://go-review.googlesource.com/11791 Reviewed-by: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/math/expm1.go')
-rw-r--r--src/math/expm1.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/math/expm1.go b/src/math/expm1.go
index 8f56e15cc4..064e131161 100644
--- a/src/math/expm1.go
+++ b/src/math/expm1.go
@@ -158,11 +158,11 @@ func expm1(x float64) float64 {
// filter out huge argument
if absx >= Ln2X56 { // if |x| >= 56 * ln2
- if absx >= Othreshold { // if |x| >= 709.78...
- return Inf(1) // overflow
- }
if sign {
- return -1 // x < -56*ln2, return -1.0
+ return -1 // x < -56*ln2, return -1
+ }
+ if absx >= Othreshold { // if |x| >= 709.78...
+ return Inf(1)
}
}