diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-10-01 08:30:06 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-10-01 08:30:06 +0000 |
commit | bec749fda1cbc1934f7e58dd2763603f4f207f26 (patch) | |
tree | 680a53e980c97e223c0e10353d83a41a5b43fdd0 /sysdeps/ieee754/dbl-64/s_fma.c | |
parent | 8ec5b01346114da38e806ca1867da688d3a360e2 (diff) | |
download | glibc-bec749fda1cbc1934f7e58dd2763603f4f207f26.tar.gz glibc-bec749fda1cbc1934f7e58dd2763603f4f207f26.tar.xz glibc-bec749fda1cbc1934f7e58dd2763603f4f207f26.zip |
Fix sign of inexact zero return from fma (bug 14645).
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_fma.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_fma.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c index c9809fb180..5e21461a4b 100644 --- a/sysdeps/ieee754/dbl-64/s_fma.c +++ b/sysdeps/ieee754/dbl-64/s_fma.c @@ -49,6 +49,11 @@ __fma (double x, double y, double z) && u.ieee.exponent != 0x7ff && v.ieee.exponent != 0x7ff) return (z + x) + y; + /* If z is zero and x are y are nonzero, compute the result + as x * y to avoid the wrong sign of a zero result if x * y + underflows to 0. */ + if (z == 0 && x != 0 && y != 0) + return x * y; /* If x or y or z is Inf/NaN, or if fma will certainly overflow, or if x * y is less than half of DBL_DENORM_MIN, compute as x * y + z. */ |