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-20 18:56:20 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-20 18:56:20 +0530
commit20cd7fb3ae63795ae7c9a464abf5ed19b364ade0 (patch)
tree1cd8a0a8ee85124fa2439fd72bb700951ea06db8 /sysdeps/ieee754/dbl-64/mpa.c
parent92945b5261c412eb590b2b34c7ec9a035f0693a1 (diff)
downloadglibc-20cd7fb3ae63795ae7c9a464abf5ed19b364ade0.tar.gz
glibc-20cd7fb3ae63795ae7c9a464abf5ed19b364ade0.tar.xz
glibc-20cd7fb3ae63795ae7c9a464abf5ed19b364ade0.zip
Copy comment about inner loop from powerpc mpa.c to the default one
Diffstat (limited to 'sysdeps/ieee754/dbl-64/mpa.c')
-rw-r--r--sysdeps/ieee754/dbl-64/mpa.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 1f60fa5a6d..845a42c5ca 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -749,6 +749,15 @@ __sqr (const mp_no *x, mp_no *y, int p)
       if (k % 2 == 0)
 	yk += X[lim] * X[lim];
 
+      /* In __mul, this loop (and the one within the next while loop) run
+         between a range to calculate the mantissa as follows:
+
+         Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1]
+		+ X[n] * Y[k]
+
+         For X == Y, we can get away with summing halfway and doubling the
+	 result.  For cases where the range size is even, the mid-point needs
+	 to be added separately (above).  */
       for (i = k - p, j = p; i < j; i++, j--)
 	yk2 += X[i] * X[j];
 
@@ -769,6 +778,7 @@ __sqr (const mp_no *x, mp_no *y, int p)
       if (k % 2 == 0)
 	yk += X[lim] * X[lim];
 
+      /* Likewise for this loop.  */
       for (i = 1, j = k - 1; i < j; i++, j--)
 	yk2 += X[i] * X[j];