Commit 8b221092 authored by Charlie Dorian's avatar Charlie Dorian Committed by Ian Lance Taylor

math: Expm1 returns -1 with large negative argument.

Fixes #11442

Change-Id: I2053fe752c6a122924d28565f1338f73e00ed417
Reviewed-on: https://go-review.googlesource.com/11791Reviewed-by: 's avatarDavid Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 1082e239
......@@ -946,16 +946,20 @@ var expSC = []float64{
var vfexpm1SC = []float64{
Inf(-1),
-710,
Copysign(0, -1),
0,
710,
Inf(1),
NaN(),
}
var expm1SC = []float64{
-1,
-1,
Copysign(0, -1),
0,
Inf(1),
Inf(1),
NaN(),
}
......
......@@ -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)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment