aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/s_fma.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-09-29 18:31:54 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-09-29 18:31:54 +0000
commit8ec5b01346114da38e806ca1867da688d3a360e2 (patch)
tree8a55bd704c2a6ca8164202217e2048bb33a7dacb /sysdeps/ieee754/dbl-64/s_fma.c
parentb1fa802e1ad4104060fe93b4b3b078ba46be0933 (diff)
downloadglibc-8ec5b01346114da38e806ca1867da688d3a360e2.zip
glibc-8ec5b01346114da38e806ca1867da688d3a360e2.tar.gz
glibc-8ec5b01346114da38e806ca1867da688d3a360e2.tar.bz2
Fix sign of exact zero return from fma (bug 14638).
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_fma.c')
-rw-r--r--sysdeps/ieee754/dbl-64/s_fma.c5
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 ce3bd36..c9809fb 100644
--- a/sysdeps/ieee754/dbl-64/s_fma.c
+++ b/sysdeps/ieee754/dbl-64/s_fma.c
@@ -128,6 +128,11 @@ __fma (double x, double y, double z)
y = v.d;
z = w.d;
}
+
+ /* Ensure correct sign of exact 0 + 0. */
+ if (__builtin_expect ((x == 0 || y == 0) && z == 0, 0))
+ return x * y + z;
+
/* Multiplication m1 + m2 = x * y using Dekker's algorithm. */
#define C ((1 << (DBL_MANT_DIG + 1) / 2) + 1)
double x1 = x * C;