This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Use HALFRAD macro instead of hardcoded value
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 20 Mar 2013 14:31:32 +0530
- Subject: [PATCH] Use HALFRAD macro instead of hardcoded value
Hi,
I cam across a few instances where 8388608.0 was used directly and
replaced those with the HALFRAD macro. No regressions on x86_64 and
i686. OK to commit? Further, would it be a good idea to consider
such cleanups (replace constants with their equivalent macros) as
obvious?
Siddhesh
* sysdeps/ieee754/dbl-64/mpsqrt.c (__mpsqrt): Use HALFRAD.
* sysdeps/ieee754/dbl-64/sincos32.c (__mpranred): Likewise.
diff --git a/sysdeps/ieee754/dbl-64/mpsqrt.c b/sysdeps/ieee754/dbl-64/mpsqrt.c
index 71ef5ce..230d1f3 100644
--- a/sysdeps/ieee754/dbl-64/mpsqrt.c
+++ b/sysdeps/ieee754/dbl-64/mpsqrt.c
@@ -53,8 +53,8 @@ __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 */}};
+ static const mp_no mphalf = {0, {1.0, HALFRAD}};
+ static const mp_no mp3halfs = {1, {1.0, 1.0, HALFRAD}};
mp_no mpxn, mpz, mpu, mpt1, mpt2;
ey = EX / 2;
diff --git a/sysdeps/ieee754/dbl-64/sincos32.c b/sysdeps/ieee754/dbl-64/sincos32.c
index 3d2b291..954db66 100644
--- a/sysdeps/ieee754/dbl-64/sincos32.c
+++ b/sysdeps/ieee754/dbl-64/sincos32.c
@@ -262,7 +262,7 @@ __mpranred(double x, mp_no *y, int p)
for (i=1;i<=p-c.e;i++) c.d[i]=c.d[i+c.e];
for (i=p+1-c.e;i<=p;i++) c.d[i]=0;
c.e=0;
- if (c.d[1] >= 8388608.0)
+ if (c.d[1] >= HALFRAD)
{ t +=1.0;
__sub(&c,&mpone,&b,p);
__mul(&b,&hp,y,p);