diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-11-30 13:28:04 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-11-30 13:28:04 +0000 |
commit | 85060905c129fe01e6e8a9ca1d4005cc38edaa49 (patch) | |
tree | 5faeded58ffa80117887dd107c350c0bcac7b372 /fma.c | |
parent | 5646684864913ec18354a0959da81d53d2474a62 (diff) | |
download | mpfr-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.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -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); |