This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use HALFRAD macro instead of hardcoded value
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 20 Mar 2013 10:18:19 +0100
- Subject: Re: [PATCH] Use HALFRAD macro instead of hardcoded value
- References: <20130320090132 dot GS25837 at spoyarek dot pnq dot redhat dot com>
On Wed, Mar 20, 2013 at 02:31:32PM +0530, Siddhesh Poyarekar wrote:
> 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?
>
git grep 8388608.0 also found
_rintf.c: static const float TWO23 = 8388608.0;
is this coincidence on could we use same macro there?
> 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);
--
Mouse chewed through power cable