about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/mpa.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-15 23:56:20 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-15 23:56:20 +0530
commit2d0e0f29f85036d1189231cb7c1f19f27ba14a89 (patch)
treef303c3a9cf28879a9dfa673018fdc9776a5db2eb /sysdeps/ieee754/dbl-64/mpa.c
parentdaaa7713e9170ec42536b5a0e46b434dd84753a5 (diff)
downloadglibc-2d0e0f29f85036d1189231cb7c1f19f27ba14a89.tar.gz
glibc-2d0e0f29f85036d1189231cb7c1f19f27ba14a89.tar.xz
glibc-2d0e0f29f85036d1189231cb7c1f19f27ba14a89.zip
Fix determination of lower precision in __mul
Diffstat (limited to 'sysdeps/ieee754/dbl-64/mpa.c')
-rw-r--r--sysdeps/ieee754/dbl-64/mpa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 542d81bdcc..25f52f65c6 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -612,6 +612,7 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
 {
   int i, j, k, ip, ip2;
   double u, zk;
+  const mp_no *a;
 
   /* Is z=0?  */
   if (__glibc_unlikely (X[0] * Y[0] == ZERO))
@@ -626,9 +627,11 @@ __mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
     if (X[ip2] != ZERO || Y[ip2] != ZERO)
       break;
 
+  a = X[ip2] != ZERO ? y : x;
+
   /* ... and here, at least one of them is still zero.  */
   for (ip = ip2; ip > 0; ip--)
-    if (X[ip] * Y[ip] != ZERO)
+    if (a->d[ip] != ZERO)
       break;
 
   /* The product looks like this for p = 3 (as an example):