summaryrefslogtreecommitdiff
path: root/src/fma.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2014-01-20 18:00:57 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2014-01-20 18:00:57 +0000
commit89a887e765284637514e6a96f01e5f1e7e7eb4a3 (patch)
tree2de2aceed24d575a73334e75bb08b5ea5676a4ad /src/fma.c
parenta48dbba9b69221dc9b9d2b7368a499ee91849544 (diff)
downloadmpfr-89a887e765284637514e6a96f01e5f1e7e7eb4a3.tar.gz
come back to revision 8723 which was faster (measured with tools/mbench/mfv5
on 53 and 1024 bits). The reason is that the "new" version had overhead for mpfr_round_p (about 40 cycles on Core 2) and mpfr_set (about 98 cycles for 53 bits, and 132 cycles for 1024 bits) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8815 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/fma.c')
-rw-r--r--src/fma.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/fma.c b/src/fma.c
index d5e32b2d5..431855677 100644
--- a/src/fma.c
+++ b/src/fma.c
@@ -115,39 +115,11 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_IS_SINGULAR(z) ))
return mpfr_fma_singular (s, x, y, z, rnd_mode);
- /* first try to use a truncated product, in case no underflow nor
- overflow happens */
- mpfr_exp_t expu;
- mpfr_flags_t saved_flags = __gmpfr_flags;
- MPFR_GROUP_INIT_1 (group, MPFR_PREC(s) + GMP_NUMB_BITS, u);
- mpfr_mul (u, x, y, MPFR_RNDZ);
- expu = MPFR_EXP(u);
- if (__gmpfr_emin < expu && expu < __gmpfr_emax)
- {
- int signu = MPFR_SIGN (u);
- mpfr_add (u, u, z, MPFR_RNDZ);
- if (__gmpfr_emin < MPFR_EXP(u) && MPFR_EXP(u) < __gmpfr_emax)
- {
- mpfr_prec_t err;
- if (signu == MPFR_SIGN(z) || expu <= MPFR_EXP(u))
- err = 1;
- else
- err = 1 + expu - MPFR_EXP(u);
- if (mpfr_can_round (u, MPFR_PREC(s) + GMP_NUMB_BITS - err, MPFR_RNDN,
- MPFR_RNDZ, MPFR_PREC(s) + (rnd_mode == MPFR_RNDN)))
- {
- inexact = mpfr_set (s, u, rnd_mode);
- MPFR_GROUP_CLEAR (group);
- return inexact;
- }
- }
- }
- __gmpfr_flags = saved_flags;
-
/* If we take prec(u) >= prec(x) + prec(y), the product u <- x*y
is exact, except in case of overflow or underflow. */
MPFR_SAVE_EXPO_MARK (expo);
- MPFR_GROUP_REPREC_1 (group, MPFR_PREC(x) + MPFR_PREC(y), u);
+ MPFR_GROUP_INIT_1 (group, MPFR_PREC(x) + MPFR_PREC(y), u);
+
if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN)))
{
/* overflow or underflow - this case is regarded as rare, thus