summaryrefslogtreecommitdiff
path: root/fma.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-11-30 13:28:04 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-11-30 13:28:04 +0000
commit85060905c129fe01e6e8a9ca1d4005cc38edaa49 (patch)
tree5faeded58ffa80117887dd107c350c0bcac7b372 /fma.c
parent5646684864913ec18354a0959da81d53d2474a62 (diff)
downloadmpfr-85060905c129fe01e6e8a9ca1d4005cc38edaa49.tar.gz
fixed detection of exact cases (in particular 0)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1603 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'fma.c')
-rw-r--r--fma.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/fma.c b/fma.c
index 0a6c1ce73..37a7898e4 100644
--- a/fma.c
+++ b/fma.c
@@ -131,24 +131,20 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x ,mpfr_srcptr y ,mpfr_srcptr z , mp_rnd_t rnd
goto fma_paul;
}
- not_exact=0;
-
/* reactualisation of the precision */
mpfr_set_prec(u,Nt);
mpfr_set_prec(t,Nt);
/* computations */
- fl1=mpfr_mul(u,x,y,GMP_RNDN);
- if(fl1) not_exact=1;
+ not_exact = mpfr_mul (u, x, y, GMP_RNDN);
- fl2=mpfr_add(t,z,u,GMP_RNDN);
- if(fl2) not_exact=1;
+ not_exact |= mpfr_add (t, z, u, GMP_RNDN);
/*Nt=Nt+(d+1)+_mpfr_ceil_log2(Nt); */
- d = MPFR_EXP(u)-MPFR_EXP(t);
+ d = MPFR_EXP(u) - MPFR_EXP(t);
/* estimation of the error */
- err=Nt-(d+1);
+ err = Nt - (d+1);
/* actualisation of the precision */
Nt +=(1-first_pass)*d + first_pass*10;
@@ -156,7 +152,8 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x ,mpfr_srcptr y ,mpfr_srcptr z , mp_rnd_t rnd
first_pass=1;
- } while ( (fl1!=fl2) || (err <0) || ((!mpfr_can_round(t,err,GMP_RNDN,rnd_mode,Ns)) && not_exact ));
+ } while (not_exact && ((err < 0) ||
+ !mpfr_can_round (t, err, GMP_RNDN, rnd_mode, Ns)));
inexact = mpfr_set (s, t, rnd_mode);
mpfr_clear(t);