From 7a845b2c237434d4aad790aaba3a973e24ea802f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 3 Jul 2012 17:10:42 +0000 Subject: Fix float range reduction problems (bug 14283). --- sysdeps/ieee754/flt-32/k_rem_pio2f.c | 37 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c index 06c2f378dc..e54a0677e4 100644 --- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c +++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c @@ -88,7 +88,7 @@ recompute: iq[jz-1] -= i<<(8-q0); ih = iq[jz-1]>>(7-q0); } - else if(q0==0) ih = iq[jz-1]>>8; + else if(q0==0) ih = iq[jz-1]>>7; else if(z>=(float)0.5) ih=2; if(ih>0) { /* q > 0.5 */ @@ -166,24 +166,33 @@ recompute: y[0] = (ih==0)? fw: -fw; break; case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; + case 2:; +#if __FLT_EVAL_METHOD__ != 0 + volatile +#endif + float fv = 0.0; + for (i=jz;i>=0;i--) fv += fq[i]; + y[0] = (ih==0)? fv: -fv; + fv = fq[0]-fv; + for (i=1;i<=jz;i++) fv += fq[i]; + y[1] = (ih==0)? fv: -fv; break; case 3: /* painful */ for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; +#if __FLT_EVAL_METHOD__ != 0 + volatile +#endif + float fv = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fv; + fq[i-1] = fv; } for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; +#if __FLT_EVAL_METHOD__ != 0 + volatile +#endif + float fv = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fv; + fq[i-1] = fv; } for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; if(ih==0) { -- cgit 1.4.1