From 09c14ed23ec3c5993f0572ca7887fe9ffedf83f8 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 27 Feb 2013 11:28:20 +0530 Subject: Format mpsqrt.c --- ChangeLog | 2 ++ sysdeps/ieee754/dbl-64/mpsqrt.c | 78 +++++++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab71f0df7a..2779753ff0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2013-02-27 Siddhesh Poyarekar + * sysdeps/ieee754/dbl-64/mpsqrt.c: Reformat. + * sysdeps/ieee754/dbl-64/mpatan2.c: Reformat. * sysdeps/ieee754/dbl-64/mpatan.c: Reformat. diff --git a/sysdeps/ieee754/dbl-64/mpsqrt.c b/sysdeps/ieee754/dbl-64/mpsqrt.c index 941a4e9cd2..71ef5ce776 100644 --- a/sysdeps/ieee754/dbl-64/mpsqrt.c +++ b/sysdeps/ieee754/dbl-64/mpsqrt.c @@ -45,33 +45,37 @@ /* p as integer. Routine computes sqrt(*x) and stores result in *y */ /****************************************************************************/ -static double fastiroot(double); +static double fastiroot (double); void SECTION -__mpsqrt(mp_no *x, mp_no *y, int p) { - int i,m,ey; - double dx,dy; - static const mp_no - mphalf = {0,{1.0,8388608.0 /* 2^23 */}}, - mp3halfs = {1,{1.0,1.0,8388608.0 /* 2^23 */}}; - mp_no mpxn,mpz,mpu,mpt1,mpt2; +__mpsqrt (mp_no *x, mp_no *y, int p) +{ + int i, m, ey; + double dx, dy; + static const mp_no mphalf = {0, {1.0, 8388608.0 /* 2^23 */}}; + static const mp_no mp3halfs = {1, {1.0, 1.0, 8388608.0 /* 2^23 */}}; + mp_no mpxn, mpz, mpu, mpt1, mpt2; - ey=EX/2; __cpy(x,&mpxn,p); mpxn.e -= (ey+ey); - __mp_dbl(&mpxn,&dx,p); dy=fastiroot(dx); __dbl_mp(dy,&mpu,p); - __mul(&mpxn,&mphalf,&mpz,p); + ey = EX / 2; + __cpy (x, &mpxn, p); + mpxn.e -= (ey + ey); + __mp_dbl (&mpxn, &dx, p); + dy = fastiroot (dx); + __dbl_mp (dy, &mpu, p); + __mul (&mpxn, &mphalf, &mpz, p); - m=__mpsqrt_mp[p]; - for (i=0; i>1; - z = ((c3*z + c2)*z + c1)*z + c0; /* 2**-7 */ - z = z*(1.5 - 0.5*y*z*z); /* 2**-14 */ - p.d = z*(1.5 - 0.5*y*z*z); /* 2**-28 */ + z = y - 1.0; + n = (q.i[HIGH_HALF] - p.i[HIGH_HALF]) >> 1; + z = ((c3 * z + c2) * z + c1) * z + c0; /* 2**-7 */ + z = z * (1.5 - 0.5 * y * z * z); /* 2**-14 */ + p.d = z * (1.5 - 0.5 * y * z * z); /* 2**-28 */ p.i[HIGH_HALF] -= n; - t = x*p.d; - return p.d*(1.5 - 0.5*p.d*t); + t = x * p.d; + return p.d * (1.5 - 0.5 * p.d * t); } -- cgit 1.4.1