summaryrefslogtreecommitdiff
path: root/mul.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-10-26 11:59:59 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2000-10-26 11:59:59 +0000
commitda4b19c01ec0e27d42071d294e29fc56e1a1b16a (patch)
tree393496f9c6cc54d9bcde0fc0d77691fdcfdf255a /mul.c
parent33336e9a85f1ae242191e1b2286cded95f11362b (diff)
downloadmpfr-da4b19c01ec0e27d42071d294e29fc56e1a1b16a.tar.gz
protected all macros: xxx -> MPFR_xxx
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@786 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul.c')
-rw-r--r--mul.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mul.c b/mul.c
index e829f1cc4..6c899f645 100644
--- a/mul.c
+++ b/mul.c
@@ -25,8 +25,8 @@ MA 02111-1307, USA. */
#include "mpfr.h"
/* Remains to do:
-- do not use all bits of b and c when PREC(b)>PREC(a) or PREC(c)>PREC(a)
- [current complexity is O(PREC(b)*PREC(c))]
+- do not use all bits of b and c when MPFR_PREC(b)>MPFR_PREC(a) or MPFR_PREC(c)>MPFR_PREC(a)
+ [current complexity is O(MPFR_PREC(b)*MPFR_PREC(c))]
*/
void
@@ -41,18 +41,18 @@ mpfr_mul(a, b, c, rnd_mode)
#endif
{
unsigned int bn, cn, an, tn, k; int cc;
- mp_limb_t *ap=MANT(a), *bp=MANT(b), *cp=MANT(c), *tmp, b1;
+ mp_limb_t *ap=MPFR_MANT(a), *bp=MPFR_MANT(b), *cp=MPFR_MANT(c), *tmp, b1;
long int sign_product;
TMP_DECL(marker);
/* deal with NaN and zero */
- if (FLAG_NAN(b) || FLAG_NAN(c)) { SET_NAN(a); return; }
- if (!NOTZERO(b) || !NOTZERO(c)) { SET_ZERO(a); return; }
+ if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c)) { MPFR_SET_NAN(a); return; }
+ if (!MPFR_NOTZERO(b) || !MPFR_NOTZERO(c)) { MPFR_SET_ZERO(a); return; }
sign_product = MPFR_SIGN(b) * MPFR_SIGN(c);
- bn = (PREC(b)-1)/BITS_PER_MP_LIMB+1; /* number of significant limbs of b */
- cn = (PREC(c)-1)/BITS_PER_MP_LIMB+1; /* number of significant limbs of c */
- tn = (PREC(c)+PREC(b)-1)/BITS_PER_MP_LIMB+1;
+ bn = (MPFR_PREC(b)-1)/BITS_PER_MP_LIMB+1; /* number of significant limbs of b */
+ cn = (MPFR_PREC(c)-1)/BITS_PER_MP_LIMB+1; /* number of significant limbs of c */
+ tn = (MPFR_PREC(c)+MPFR_PREC(b)-1)/BITS_PER_MP_LIMB+1;
k = bn+cn; /* effective nb of limbs used by b*c */
TMP_MARK(marker);
tmp = (mp_limb_t*) TMP_ALLOC(k*BYTES_PER_MP_LIMB);
@@ -62,17 +62,17 @@ mpfr_mul(a, b, c, rnd_mode)
/* now tmp[0]..tmp[k-1] contains the product of both mantissa,
with tmp[k-1]>=2^(BITS_PER_MP_LIMB-2) */
- an = (PREC(a)-1)/BITS_PER_MP_LIMB+1; /* number of significant limbs of a */
+ an = (MPFR_PREC(a)-1)/BITS_PER_MP_LIMB+1; /* number of significant limbs of a */
b1 >>= BITS_PER_MP_LIMB-1; /* msb from the product */
if (b1==0) mpn_lshift(tmp, tmp, k, 1);
cc = mpfr_round_raw(ap, tmp+bn+cn-tn,
- PREC(b)+PREC(c), (sign_product<0), PREC(a), rnd_mode);
+ MPFR_PREC(b)+MPFR_PREC(c), (sign_product<0), MPFR_PREC(a), rnd_mode);
if (cc) { /* cc = 1 ==> result is a power of two */
ap[an-1] = (mp_limb_t) 1 << (BITS_PER_MP_LIMB-1);
}
- EXP(a) = EXP(b) + EXP(c) + b1 - 1 + cc;
- if (sign_product * MPFR_SIGN(a)<0) CHANGE_SIGN(a);
+ MPFR_EXP(a) = MPFR_EXP(b) + MPFR_EXP(c) + b1 - 1 + cc;
+ if (sign_product * MPFR_SIGN(a)<0) MPFR_CHANGE_SIGN(a);
TMP_FREE(marker);
return;
}