diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-07-03 17:10:42 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-07-03 17:11:41 +0000 |
commit | 7a845b2c237434d4aad790aaba3a973e24ea802f (patch) | |
tree | 16a6f0e49ff1b9b6a28f61fd16bb39821e2f54cf /sysdeps/ieee754/flt-32 | |
parent | e2283f38febb8f1721f896680bed251ceef58a6b (diff) | |
download | glibc-7a845b2c237434d4aad790aaba3a973e24ea802f.tar.gz glibc-7a845b2c237434d4aad790aaba3a973e24ea802f.tar.xz glibc-7a845b2c237434d4aad790aaba3a973e24ea802f.zip |
Fix float range reduction problems (bug 14283).
Diffstat (limited to 'sysdeps/ieee754/flt-32')
-rw-r--r-- | sysdeps/ieee754/flt-32/k_rem_pio2f.c | 37 |
1 files changed, 23 insertions, 14 deletions
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) { |