diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-17 14:20:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-17 14:20:29 +0000 |
commit | c6d6367f848cfd8381aba41e035c5e7e873667c5 (patch) | |
tree | a218e98243463fc27f5053b4444e2544c63cd57a /libgo/go/math | |
parent | 9bff0086915f544fa648ea81131f035cb9ce79a4 (diff) | |
download | gcc-c6d6367f848cfd8381aba41e035c5e7e873667c5.zip gcc-c6d6367f848cfd8381aba41e035c5e7e873667c5.tar.gz gcc-c6d6367f848cfd8381aba41e035c5e7e873667c5.tar.bz2 |
libgo: update to Go1.10beta2 release
Reviewed-on: https://go-review.googlesource.com/87897
From-SVN: r256794
Diffstat (limited to 'libgo/go/math')
-rw-r--r-- | libgo/go/math/all_test.go | 6 | ||||
-rw-r--r-- | libgo/go/math/pow.go | 8 | ||||
-rw-r--r-- | libgo/go/math/rand/rand.go | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/libgo/go/math/all_test.go b/libgo/go/math/all_test.go index 0412c19..6682395 100644 --- a/libgo/go/math/all_test.go +++ b/libgo/go/math/all_test.go @@ -1589,6 +1589,7 @@ var vfpowSC = [][2]float64{ {Inf(-1), 1}, {Inf(-1), 3}, {Inf(-1), Pi}, + {Inf(-1), 0.5}, {Inf(-1), NaN()}, {-Pi, Inf(-1)}, @@ -1607,9 +1608,11 @@ var vfpowSC = [][2]float64{ {-1 / 2, Inf(1)}, {Copysign(0, -1), Inf(-1)}, {Copysign(0, -1), -Pi}, + {Copysign(0, -1), -0.5}, {Copysign(0, -1), -3}, {Copysign(0, -1), 3}, {Copysign(0, -1), Pi}, + {Copysign(0, -1), 0.5}, {Copysign(0, -1), Inf(1)}, {0, Inf(-1)}, @@ -1666,6 +1669,7 @@ var powSC = []float64{ Inf(-1), // pow(-Inf, 1) Inf(-1), // pow(-Inf, 3) Inf(1), // pow(-Inf, Pi) + Inf(1), // pow(-Inf, 0.5) NaN(), // pow(-Inf, NaN) 0, // pow(-Pi, -Inf) NaN(), // pow(-Pi, -Pi) @@ -1682,9 +1686,11 @@ var powSC = []float64{ 0, // pow(-1/2, +Inf) Inf(1), // pow(-0, -Inf) Inf(1), // pow(-0, -Pi) + Inf(1), // pow(-0, -0.5) Inf(-1), // pow(-0, -3) IEEE 754-2008 Copysign(0, -1), // pow(-0, 3) IEEE 754-2008 0, // pow(-0, +Pi) + 0, // pow(-0, 0.5) 0, // pow(-0, +Inf) Inf(1), // pow(+0, -Inf) Inf(1), // pow(+0, -Pi) diff --git a/libgo/go/math/pow.go b/libgo/go/math/pow.go index e255ee4..314ff90 100644 --- a/libgo/go/math/pow.go +++ b/libgo/go/math/pow.go @@ -48,10 +48,6 @@ func pow(x, y float64) float64 { return 1 case y == 1: return x - case y == 0.5: - return Sqrt(x) - case y == -0.5: - return 1 / Sqrt(x) case IsNaN(x) || IsNaN(y): return NaN() case x == 0: @@ -86,6 +82,10 @@ func pow(x, y float64) float64 { case y > 0: return Inf(1) } + case y == 0.5: + return Sqrt(x) + case y == -0.5: + return 1 / Sqrt(x) } absy := y diff --git a/libgo/go/math/rand/rand.go b/libgo/go/math/rand/rand.go index 957bebd..147c92f 100644 --- a/libgo/go/math/rand/rand.go +++ b/libgo/go/math/rand/rand.go @@ -393,7 +393,7 @@ func (r *lockedSource) Seed(seed int64) { r.lk.Unlock() } -// seedPos implements Seed for a lockedSource without a race condiiton. +// seedPos implements Seed for a lockedSource without a race condition. func (r *lockedSource) seedPos(seed int64, readPos *int8) { r.lk.Lock() r.src.Seed(seed) |