aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-04-27 16:32:42 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-04-27 16:32:42 +0000
commit6c88c77ec7b29cc5ab216e867bd1967e6c9aa8e0 (patch)
tree8a6aa1b0241651d494e4bbac70e2c0cd0613f1de /libgo/go
parentf07bb470aeab62b605103453e28b4d55909e9928 (diff)
downloadgcc-6c88c77ec7b29cc5ab216e867bd1967e6c9aa8e0.zip
gcc-6c88c77ec7b29cc5ab216e867bd1967e6c9aa8e0.tar.gz
gcc-6c88c77ec7b29cc5ab216e867bd1967e6c9aa8e0.tar.bz2
re PR go/52358 (math FAILs on Solaris 8 and 9)
PR go/52358 math: Work around bug in Solaris 9 implementation of ldexp. The bug is that ldexp(-1, -1075) should return -0, but the Solaris 9 implementation returns +0. From-SVN: r186913
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/math/ldexp.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/libgo/go/math/ldexp.go b/libgo/go/math/ldexp.go
index 32c9853..4c63edd 100644
--- a/libgo/go/math/ldexp.go
+++ b/libgo/go/math/ldexp.go
@@ -16,7 +16,18 @@ package math
func libc_ldexp(float64, int) float64
func Ldexp(frac float64, exp int) float64 {
- return libc_ldexp(frac, exp)
+ r := libc_ldexp(frac, exp)
+
+ // Work around a bug in the implementation of ldexp on Solaris
+ // 9. If multiplying a negative number by 2 raised to a
+ // negative exponent underflows, we want to return negative
+ // zero, but the Solaris 9 implementation returns positive
+ // zero. This workaround can be removed when and if we no
+ // longer care about Solaris 9.
+ if r == 0 && frac < 0 && exp < 0 {
+ r = Copysign(0, frac)
+ }
+ return r
}
func ldexp(frac float64, exp int) float64 {