aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-27 11:26:22 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-27 11:26:22 +0530
commit6295157a774bd5fd3c169d3cdd888e2f947767c5 (patch)
tree7e24b511d9a963448685c90261b131b23506b8d4
parentb8de22026d71f539fb1f67c964d2a1ffe989bf83 (diff)
downloadglibc-6295157a774bd5fd3c169d3cdd888e2f947767c5.tar
glibc-6295157a774bd5fd3c169d3cdd888e2f947767c5.tar.gz
glibc-6295157a774bd5fd3c169d3cdd888e2f947767c5.tar.bz2
glibc-6295157a774bd5fd3c169d3cdd888e2f947767c5.zip
Format mpatan.c
-rw-r--r--ChangeLog2
-rw-r--r--sysdeps/ieee754/dbl-64/mpatan.c107
2 files changed, 63 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 20ef3fe7eb..06bcafa3d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2013-02-27 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * sysdeps/ieee754/dbl-64/mpatan.c: Reformat.
+
* sysdeps/ieee754/dbl-64/mptan.c: Reformat.
* sysdeps/ieee754/dbl-64/mplog.c: Reformat.
diff --git a/sysdeps/ieee754/dbl-64/mpatan.c b/sysdeps/ieee754/dbl-64/mpatan.c
index 0f5a24a3c7..cc879d8ec4 100644
--- a/sysdeps/ieee754/dbl-64/mpatan.c
+++ b/sysdeps/ieee754/dbl-64/mpatan.c
@@ -39,63 +39,78 @@
#include "mpatan.h"
-void __mpsqrt(mp_no *, mp_no *, int);
-
void
SECTION
-__mpatan(mp_no *x, mp_no *y, int p) {
+__mpatan (mp_no *x, mp_no *y, int p)
+{
- int i,m,n;
+ int i, m, n;
double dx;
- mp_no
- mptwoim1 = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
- 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
+ mp_no mptwoim1 =
+ {
+ 0,
+ {
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
+ }
+ };
- mp_no mps,mpsm,mpt,mpt1,mpt2,mpt3;
+ mp_no mps, mpsm, mpt, mpt1, mpt2, mpt3;
- /* Choose m and initiate mptwoim1 */
- if (EX>0) m=7;
- else if (EX<0) m=0;
- else {
- __mp_dbl(x,&dx,p); dx=ABS(dx);
- for (m=6; m>0; m--)
- {if (dx>__atan_xm[m].d) break;}
+ /* Choose m and initiate mptwoim1. */
+ if (EX > 0)
+ m = 7;
+ else if (EX < 0)
+ m = 0;
+ else
+ {
+ __mp_dbl (x, &dx, p);
+ dx = ABS (dx);
+ for (m = 6; m > 0; m--)
+ {
+ if (dx > __atan_xm[m].d)
+ break;
+ }
}
- mptwoim1.e = 1;
- mptwoim1.d[0] = ONE;
+ mptwoim1.e = 1;
+ mptwoim1.d[0] = ONE;
- /* Reduce x m times */
- __sqr(x,&mpsm,p);
- if (m==0) __cpy(x,&mps,p);
- else {
- for (i=0; i<m; i++) {
- __add(&mpone,&mpsm,&mpt1,p);
- __mpsqrt(&mpt1,&mpt2,p);
- __add(&mpt2,&mpt2,&mpt1,p);
- __add(&mptwo,&mpsm,&mpt2,p);
- __add(&mpt1,&mpt2,&mpt3,p);
- __dvd(&mpsm,&mpt3,&mpt1,p);
- __cpy(&mpt1,&mpsm,p);
- }
- __mpsqrt(&mpsm,&mps,p); mps.d[0] = X[0];
+ /* Reduce x m times. */
+ __sqr (x, &mpsm, p);
+ if (m == 0)
+ __cpy (x, &mps, p);
+ else
+ {
+ for (i = 0; i < m; i++)
+ {
+ __add (&mpone, &mpsm, &mpt1, p);
+ __mpsqrt (&mpt1, &mpt2, p);
+ __add (&mpt2, &mpt2, &mpt1, p);
+ __add (&mptwo, &mpsm, &mpt2, p);
+ __add (&mpt1, &mpt2, &mpt3, p);
+ __dvd (&mpsm, &mpt3, &mpt1, p);
+ __cpy (&mpt1, &mpsm, p);
+ }
+ __mpsqrt (&mpsm, &mps, p);
+ mps.d[0] = X[0];
}
- /* Evaluate a truncated power series for Atan(s) */
- n=__atan_np[p]; mptwoim1.d[1] = __atan_twonm1[p].d;
- __dvd(&mpsm,&mptwoim1,&mpt,p);
- for (i=n-1; i>1; i--) {
+ /* Evaluate a truncated power series for Atan(s). */
+ n = __atan_np[p];
+ mptwoim1.d[1] = __atan_twonm1[p].d;
+ __dvd (&mpsm, &mptwoim1, &mpt, p);
+ for (i = n - 1; i > 1; i--)
+ {
mptwoim1.d[1] -= TWO;
- __dvd(&mpsm,&mptwoim1,&mpt1,p);
- __mul(&mpsm,&mpt,&mpt2,p);
- __sub(&mpt1,&mpt2,&mpt,p);
+ __dvd (&mpsm, &mptwoim1, &mpt1, p);
+ __mul (&mpsm, &mpt, &mpt2, p);
+ __sub (&mpt1, &mpt2, &mpt, p);
}
- __mul(&mps,&mpt,&mpt1,p);
- __sub(&mps,&mpt1,&mpt,p);
-
- /* Compute Atan(x) */
- mptwoim1.d[1] = 1 << m;
- __mul(&mptwoim1,&mpt,y,p);
+ __mul (&mps, &mpt, &mpt1, p);
+ __sub (&mps, &mpt1, &mpt, p);
- return;
+ /* Compute Atan(x). */
+ mptwoim1.d[1] = 1 << m;
+ __mul (&mptwoim1, &mpt, y, p);
}