diff options
-rw-r--r-- | add1.c | 10 | ||||
-rw-r--r-- | add1sp.c | 4 | ||||
-rw-r--r-- | add_one_ulp.c | 13 | ||||
-rw-r--r-- | cache.c | 4 | ||||
-rw-r--r-- | div.c | 4 | ||||
-rw-r--r-- | div_2si.c | 6 | ||||
-rw-r--r-- | div_2ui.c | 4 | ||||
-rw-r--r-- | exceptions.c | 26 | ||||
-rw-r--r-- | exp.c | 6 | ||||
-rw-r--r-- | exp2.c | 6 | ||||
-rw-r--r-- | mpfr-impl.h | 4 | ||||
-rw-r--r-- | mul.c | 11 | ||||
-rw-r--r-- | mul_2si.c | 6 | ||||
-rw-r--r-- | mul_2ui.c | 4 | ||||
-rw-r--r-- | mul_ui.c | 2 | ||||
-rw-r--r-- | pow.c | 2 | ||||
-rw-r--r-- | pow_ui.c | 7 | ||||
-rw-r--r-- | pow_z.c | 10 | ||||
-rw-r--r-- | rint.c | 8 | ||||
-rw-r--r-- | round_prec.c | 5 | ||||
-rw-r--r-- | set.c | 4 | ||||
-rw-r--r-- | set_q.c | 6 | ||||
-rw-r--r-- | set_si.c | 4 | ||||
-rw-r--r-- | set_sj.c | 2 | ||||
-rw-r--r-- | set_ui.c | 4 | ||||
-rw-r--r-- | set_uj.c | 8 | ||||
-rw-r--r-- | set_z.c | 13 | ||||
-rw-r--r-- | sqr.c | 6 | ||||
-rw-r--r-- | strtofr.c | 10 | ||||
-rw-r--r-- | sub1.c | 4 | ||||
-rw-r--r-- | sub1sp.c | 6 | ||||
-rw-r--r-- | sub_one_ulp.c | 4 | ||||
-rw-r--r-- | tests/texceptions.c | 4 |
33 files changed, 110 insertions, 107 deletions
@@ -1,6 +1,6 @@ /* mpfr_add1 -- internal function to perform a "real" addition -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation. Contributed by the Spaces project, INRIA Lorraine. This file is part of the MPFR Library. @@ -155,7 +155,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { if (MPFR_UNLIKELY(exp == __gmpfr_emax)) { - inex = mpfr_set_overflow(a, rnd_mode, MPFR_SIGN(a)); + inex = mpfr_overflow(a, rnd_mode, MPFR_SIGN(a)); goto end_of_add; } exp++; @@ -296,7 +296,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { if (exp == __gmpfr_emax) { - inex = mpfr_set_overflow(a, rnd_mode, MPFR_SIGN(a)); + inex = mpfr_overflow(a, rnd_mode, MPFR_SIGN(a)); goto end_of_add; } exp++; @@ -349,7 +349,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { if (MPFR_UNLIKELY(exp == __gmpfr_emax)) { - inex = mpfr_set_overflow(a, rnd_mode, MPFR_SIGN(a)); + inex = mpfr_overflow(a, rnd_mode, MPFR_SIGN(a)); goto end_of_add; } exp++; @@ -525,7 +525,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { /* Case 100000x0 + 1*/ if (MPFR_UNLIKELY(exp == __gmpfr_emax)) - inex = mpfr_set_overflow(a, rnd_mode, MPFR_SIGN(a)); + inex = mpfr_overflow(a, rnd_mode, MPFR_SIGN(a)); else { exp++; @@ -1,7 +1,7 @@ /* mpfr_add1sp -- internal function to perform a "real" addition All the op must have the same precision -Copyright 2004 Free Software Foundation. +Copyright 2004, 2005 Free Software Foundation. Contributed by the Spaces project, INRIA Lorraine. This file is part of the MPFR Library. @@ -324,7 +324,7 @@ mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) DEBUG( printf("Overflow\n") ); TMP_FREE(marker); MPFR_SET_SAME_SIGN(a,b); - return mpfr_set_overflow(a, rnd_mode, MPFR_SIGN(a)); + return mpfr_overflow(a, rnd_mode, MPFR_SIGN(a)); } MPFR_SET_EXP (a, bx); MPFR_SET_SAME_SIGN(a,b); diff --git a/add_one_ulp.c b/add_one_ulp.c index 2444651ae..23ca5bce6 100644 --- a/add_one_ulp.c +++ b/add_one_ulp.c @@ -1,6 +1,6 @@ /* mpfr_add_one_ulp -- add one unit in last place -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -19,7 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "mpfr-impl.h" /* sets x to x+sign(x)*ulp(x) */ @@ -30,12 +29,12 @@ mpfr_add_one_ulp (mpfr_ptr x, mp_rnd_t rnd_mode) int sh; mp_limb_t *xp; - if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) )) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) { - if (MPFR_IS_NAN(x)) + if (MPFR_IS_NAN (x)) MPFR_RET_NAN; - MPFR_ASSERTD (MPFR_IS_INF(x) || MPFR_IS_ZERO(x)); - MPFR_RET(0); + MPFR_ASSERTD (MPFR_IS_INF (x) || MPFR_IS_ZERO (x)); + MPFR_RET (0); } xn = MPFR_LIMB_SIZE(x); @@ -45,7 +44,7 @@ mpfr_add_one_ulp (mpfr_ptr x, mp_rnd_t rnd_mode) { mp_exp_t exp = MPFR_EXP (x); if (MPFR_UNLIKELY(exp == __gmpfr_emax)) - return mpfr_set_overflow(x, rnd_mode, MPFR_SIGN(x)); + return mpfr_overflow(x, rnd_mode, MPFR_SIGN(x)); else { MPFR_ASSERTD (exp < __gmpfr_emax); @@ -1,6 +1,6 @@ /* mpfr_cache -- cache interface for multi-precision const in MPFR. -Copyright 2004 Free Software Foundation. +Copyright 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -79,7 +79,7 @@ mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mp_rnd_t rnd) MPFR_RNDRAW_EVEN (inexact, dest, MPFR_MANT (cache->x), MPFR_PREC (cache->x), rnd, sign, if (MPFR_UNLIKELY ( ++MPFR_EXP (dest) > __gmpfr_emax)) - mpfr_set_overflow (dest, rnd, sign) ); + mpfr_overflow (dest, rnd, sign) ); /* inexact = mpfr_set (dest, cache->x, rnd); */ if (MPFR_LIKELY(cache->inexact != 0)) { @@ -624,13 +624,13 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mp_rnd_t rnd_mode) /* check for underflow/overflow */ if (MPFR_UNLIKELY(qexp > __gmpfr_emax)) - return mpfr_set_overflow (q, rnd_mode, sign_quotient); + return mpfr_overflow (q, rnd_mode, sign_quotient); else if (MPFR_UNLIKELY(qexp < __gmpfr_emin)) { if (rnd_mode == GMP_RNDN && ((qexp < __gmpfr_emin - 1) || (inex == 0 && mpfr_powerof2_raw (q)))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (q, rnd_mode, sign_quotient); + return mpfr_underflow (q, rnd_mode, sign_quotient); } MPFR_SET_EXP(q, qexp); @@ -1,6 +1,6 @@ /* mpfr_div_2si -- divide a floating-point number by a power of two -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -38,12 +38,12 @@ mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode) (__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) || exp < __gmpfr_emin + (n - 1) || mpfr_powerof2_raw (y))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y)); + return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y)); } if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n || exp > __gmpfr_emax + n)) ) - return mpfr_set_overflow (y, rnd_mode, MPFR_SIGN(y)); + return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); MPFR_SET_EXP (y, exp - n); } @@ -1,6 +1,6 @@ /* mpfr_div_2ui -- divide a floating-point number by a power of two -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -56,7 +56,7 @@ mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mp_rnd_t rnd_mode) exp < __gmpfr_emin + (long) (n - 1) || mpfr_powerof2_raw (y))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y)); + return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y)); } MPFR_SET_EXP(y, exp - (long) n); diff --git a/exceptions.c b/exceptions.c index a144c0ffa..4e87b082b 100644 --- a/exceptions.c +++ b/exceptions.c @@ -1,6 +1,6 @@ /* Exception flags and utilities. -Copyright 2001, 2002, 2003, 2004 Free Software Foundation. +Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -157,7 +157,7 @@ mpfr_check_range (mpfr_ptr x, int t, mp_rnd_t rnd_mode) if (MPFR_UNLIKELY( exp < __gmpfr_emin) ) { /* The following test is necessary because in the rounding to the - * nearest mode, mpfr_set_underflow always rounds away from 0. In + * nearest mode, mpfr_underflow always rounds away from 0. In * this rounding mode, we need to round to 0 if: * _ |x| < 2^(emin-2), or * _ |x| = 2^(emin-2) and the absolute value of the exact @@ -168,10 +168,10 @@ mpfr_check_range (mpfr_ptr x, int t, mp_rnd_t rnd_mode) (mpfr_powerof2_raw(x) && (MPFR_IS_NEG(x) ? t <= 0 : t >= 0)))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow(x, rnd_mode, MPFR_SIGN(x)); + return mpfr_underflow(x, rnd_mode, MPFR_SIGN(x)); } if (MPFR_UNLIKELY( exp > __gmpfr_emax) ) - return mpfr_set_overflow(x, rnd_mode, MPFR_SIGN(x)); + return mpfr_overflow(x, rnd_mode, MPFR_SIGN(x)); } return t; /* propagate inexact ternary value, unlike most functions */ } @@ -216,22 +216,22 @@ mpfr_erangeflag_p (void) return __gmpfr_flags & MPFR_FLAGS_ERANGE; } -/* #undef mpfr_set_underflow */ +/* #undef mpfr_underflow */ -/* Note: In the rounding to the nearest mode, mpfr_set_underflow +/* Note: In the rounding to the nearest mode, mpfr_underflow always rounds away from 0. In this rounding mode, you must call - mpfr_set_underflow with rnd_mode = GMP_RNDZ if the exact result + mpfr_underflow with rnd_mode = GMP_RNDZ if the exact result is <= 2^(emin-2) in absolute value. */ int -mpfr_set_underflow (mpfr_ptr x, mp_rnd_t rnd_mode, int sign) +mpfr_underflow (mpfr_ptr x, mp_rnd_t rnd_mode, int sign) { int inex; - MPFR_ASSERT_SIGN(sign); - MPFR_CLEAR_FLAGS(x); + MPFR_ASSERT_SIGN (sign); + if (rnd_mode == GMP_RNDN - || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd_mode, sign > 0)) + || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd_mode, MPFR_IS_POS_SIGN (sign))) { mpfr_setmin (x, __gmpfr_emin); inex = 1; @@ -246,10 +246,10 @@ mpfr_set_underflow (mpfr_ptr x, mp_rnd_t rnd_mode, int sign) return sign > 0 ? inex : -inex; } -/* #undef mpfr_set_overflow */ +/* #undef mpfr_overflow */ int -mpfr_set_overflow (mpfr_ptr x, mp_rnd_t rnd_mode, int sign) +mpfr_overflow (mpfr_ptr x, mp_rnd_t rnd_mode, int sign) { int inex; @@ -69,16 +69,16 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) /* TODO: Don't convert to double! */ d = mpfr_get_d1 (x); if (MPFR_UNLIKELY (d >= (double) __gmpfr_emax * LOG2)) - return mpfr_set_overflow (y, rnd_mode, 1); + return mpfr_overflow (y, rnd_mode, 1); /* result is 0 when exp(x) < 1/2*2^(__gmpfr_emin), i.e. x < (__gmpfr_emin-1) * LOG2 */ if (MPFR_UNLIKELY(d < ((double) __gmpfr_emin - 1.0) * LOG2)) { - /* warning: mpfr_set_underflow rounds away for RNDN */ + /* warning: mpfr_underflow rounds away for RNDN */ if (rnd_mode == GMP_RNDN && d < ((double) __gmpfr_emin - 2.0) * LOG2) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (y, rnd_mode, 1); + return mpfr_underflow (y, rnd_mode, 1); } /* if x < 2^(-precy), then exp(x) i.e. gives 1 +/- 1 ulp(1) */ @@ -1,6 +1,6 @@ /* mpfr_exp2 -- power of 2 function 2^y -Copyright 2001, 2002, 2003, 2004 Free Software Foundation. +Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -66,7 +66,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) if (rnd_mode == GMP_RNDN && mpfr_cmp_si_2exp (x, __gmpfr_emin - 2, 0) <= 0) rnd2 = GMP_RNDZ; - return mpfr_set_underflow (y, rnd2, 1); + return mpfr_underflow (y, rnd2, 1); } if (mpfr_integer_p (x)) /* we know that x >= 2^(emin-1) */ @@ -75,7 +75,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) MPFR_ASSERTN(MPFR_EMAX_MAX <= LONG_MAX); if (mpfr_cmp_si_2exp (x, __gmpfr_emax, 0) > 0) - return mpfr_set_overflow (y, rnd_mode, 1); + return mpfr_overflow (y, rnd_mode, 1); xd = mpfr_get_si (x, GMP_RNDN); diff --git a/mpfr-impl.h b/mpfr-impl.h index fe3fda6dd..c8fc8206a 100644 --- a/mpfr-impl.h +++ b/mpfr-impl.h @@ -1154,8 +1154,8 @@ int strncasecmp _MPFR_PROTO ((const char *, const char *, size_t)); int mpfr_strncasecmp _MPFR_PROTO ((const char *, const char *, size_t)); #endif -int mpfr_set_underflow _MPFR_PROTO ((mpfr_ptr, mp_rnd_t, int)); -int mpfr_set_overflow _MPFR_PROTO ((mpfr_ptr, mp_rnd_t, int)); +int mpfr_underflow _MPFR_PROTO ((mpfr_ptr, mp_rnd_t, int)); +int mpfr_overflow _MPFR_PROTO ((mpfr_ptr, mp_rnd_t, int)); /* void mpfr_save_emin_emax _MPFR_PROTO ((void)); void mpfr_restore_emin_emax _MPFR_PROTO ((void)); */ @@ -1,6 +1,7 @@ /* mpfr_mul -- multiply two floating-point numbers -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -89,9 +90,9 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) * and we are doing further mults...*/ #ifdef HUGE if (MPFR_UNLIKELY (ax > __gmpfr_emax + 1)) - return mpfr_set_overflow (a, rnd_mode, sign); + return mpfr_overflow (a, rnd_mode, sign); if (MPFR_UNLIKELY (ax < __gmpfr_emin - 2)) - return mpfr_set_underflow (a, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode, + return mpfr_underflow (a, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode, sign); #endif @@ -133,7 +134,7 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) MPFR_EXP (a) = ax2; /* Can't use MPFR_SET_EXP: Exponent may be out of range */ MPFR_SET_SIGN (a, sign); if (MPFR_UNLIKELY (ax2 > __gmpfr_emax)) - return mpfr_set_overflow (a, rnd_mode, sign); + return mpfr_overflow (a, rnd_mode, sign); if (MPFR_UNLIKELY (ax2 < __gmpfr_emin)) { /* In the rounding to the nearest mode, if the exponent of the exact @@ -144,7 +145,7 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) && (ax + (mp_exp_t) b1 < __gmpfr_emin || (mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c)))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (a, rnd_mode, sign); + return mpfr_underflow (a, rnd_mode, sign); } return inexact; } @@ -1,6 +1,6 @@ /* mpfr_mul_2si -- multiply a floating-point number by a power of two -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -33,7 +33,7 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode) mp_exp_t exp = MPFR_GET_EXP (y); if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n || exp > __gmpfr_emax - n))) - return mpfr_set_overflow (y, rnd_mode, MPFR_SIGN(y)); + return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n || exp < __gmpfr_emin - n))) @@ -42,7 +42,7 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode) (__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) || exp < __gmpfr_emin - (n + 1) || mpfr_powerof2_raw (y))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y)); + return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y)); } MPFR_SET_EXP (y, exp + n); } @@ -1,6 +1,6 @@ /* mpfr_mul_2ui -- multiply a floating-point number by a power of two -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -49,7 +49,7 @@ mpfr_mul_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd_mode) mp_exp_t exp = MPFR_GET_EXP (y); if (MPFR_UNLIKELY( __gmpfr_emax < MPFR_EMIN_MIN + (long) n || exp > __gmpfr_emax - (long) n)) - return mpfr_set_overflow (y, rnd_mode, MPFR_SIGN(y)); + return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); MPFR_SET_EXP (y, exp + (long) n); } @@ -119,7 +119,7 @@ mpfr_mul_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode) if (MPFR_UNLIKELY(__gmpfr_emax < MPFR_EMAX_MIN + cnt || MPFR_GET_EXP (x) > __gmpfr_emax - cnt)) - return mpfr_set_overflow(y, rnd_mode, MPFR_SIGN(x)); + return mpfr_overflow(y, rnd_mode, MPFR_SIGN(x)); MPFR_SET_EXP (y, MPFR_GET_EXP (x) + cnt); MPFR_SET_SAME_SIGN(y, x); @@ -315,7 +315,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode) if (exy >= (double) __gmpfr_emax) { negative = MPFR_SIGN(x) < 0 && is_odd (y); - return mpfr_set_overflow (z, rnd_mode, negative ? -1 : 1); + return mpfr_overflow (z, rnd_mode, negative ? -1 : 1); } } @@ -1,7 +1,8 @@ /* mpfr_pow_ui-- compute the power of a floating-point by a machine integer -Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -121,7 +122,7 @@ mpfr_pow_ui (mpfr_ptr x, mpfr_srcptr y, unsigned long int n, mp_rnd_t rnd) /* Check Overflow */ if (MPFR_UNLIKELY (mpfr_overflow_p ())) { MPFR_SAVE_EXPO_FREE (expo); - return mpfr_set_overflow (x, rnd, + return mpfr_overflow (x, rnd, (n % 2) ? MPFR_SIGN (y) : MPFR_SIGN_POS); } /* Check Underflow */ @@ -130,7 +131,7 @@ mpfr_pow_ui (mpfr_ptr x, mpfr_srcptr y, unsigned long int n, mp_rnd_t rnd) if (rnd == GMP_RNDN) rnd = GMP_RNDZ; MPFR_SAVE_EXPO_FREE (expo); - return mpfr_set_underflow (x, rnd, + return mpfr_underflow (x, rnd, (n % 2) ? MPFR_SIGN(y) : MPFR_SIGN_POS); } MPFR_SAVE_EXPO_FREE (expo); @@ -73,14 +73,14 @@ mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd) /* Check Overflow */ if (MPFR_UNLIKELY (mpfr_overflow_p ())) - return mpfr_set_overflow (y, rnd, + return mpfr_overflow (y, rnd, mpz_odd_p (absz) ? MPFR_SIGN (x) : MPFR_SIGN_POS); /* Check Underflow */ else if (MPFR_UNLIKELY (mpfr_underflow_p ())) { if (rnd == GMP_RNDN) rnd = GMP_RNDZ; - return mpfr_set_underflow (y, rnd, + return mpfr_underflow (y, rnd, mpz_odd_p (absz) ? MPFR_SIGN (x) : MPFR_SIGN_POS); } return inexact; @@ -160,7 +160,7 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd) if (MPFR_UNLIKELY (mpz_cmp_si (tmp, __gmpfr_emin) < 0)) { /* The following test is necessary because in the rounding to the - * nearest mode, mpfr_set_underflow always rounds away from 0. In + * nearest mode, mpfr_underflow always rounds away from 0. In * this rounding mode, we need to round to 0 if: * _ |y| < 2^(emin-2), or * _ |y| = 2^(emin-2) and the absolute value of the exact @@ -169,10 +169,10 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd) */ if (rnd == GMP_RNDN && mpz_cmp_si (tmp, __gmpfr_emin-1) < 0) rnd = GMP_RNDZ; - inexact = mpfr_set_underflow (y, rnd, MPFR_SIGN (y)); + inexact = mpfr_underflow (y, rnd, MPFR_SIGN (y)); } else if (MPFR_UNLIKELY (mpz_cmp_si (tmp, __gmpfr_emax) > 0)) - inexact = mpfr_set_overflow (y, rnd, MPFR_SIGN(x)); + inexact = mpfr_overflow (y, rnd, MPFR_SIGN(x)); else MPFR_SET_EXP (y, mpz_get_si (tmp)); mpz_clear (tmp); @@ -283,7 +283,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) if (rnd_away && mpn_add_1(rp, rp, rn, MPFR_LIMB_ONE << sh)) { if (exp == __gmpfr_emax) - return mpfr_set_overflow(r, rnd_mode, MPFR_SIGN(r)) >= 0 ? + return mpfr_overflow(r, rnd_mode, MPFR_SIGN(r)) >= 0 ? uflags : -uflags; else { @@ -347,7 +347,7 @@ mpfr_rint_round (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) mpfr_clear_overflow (); mpfr_round (tmp, u); inex = (mpfr_overflow_p () - ? mpfr_set_overflow (r, rnd_mode, MPFR_SIGN (u)) + ? mpfr_overflow (r, rnd_mode, MPFR_SIGN (u)) : mpfr_set (r, tmp, rnd_mode)); mpfr_clear (tmp); MPFR_SAVE_EXPO_FREE (expo); @@ -398,7 +398,7 @@ mpfr_rint_ceil (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) mpfr_clear_overflow (); mpfr_ceil (tmp, u); inex = (mpfr_overflow_p () - ? mpfr_set_overflow (r, rnd_mode, MPFR_SIGN_POS) + ? mpfr_overflow (r, rnd_mode, MPFR_SIGN_POS) : mpfr_set (r, tmp, rnd_mode)); mpfr_clear (tmp); MPFR_SAVE_EXPO_FREE (expo); @@ -425,7 +425,7 @@ mpfr_rint_floor (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) mpfr_clear_overflow (); mpfr_floor (tmp, u); inex = (mpfr_overflow_p () - ? mpfr_set_overflow (r, rnd_mode, MPFR_SIGN_NEG) + ? mpfr_overflow (r, rnd_mode, MPFR_SIGN_NEG) : mpfr_set (r, tmp, rnd_mode)); mpfr_clear (tmp); MPFR_SAVE_EXPO_FREE (expo); diff --git a/round_prec.c b/round_prec.c index 5e448488f..0d291ff38 100644 --- a/round_prec.c +++ b/round_prec.c @@ -1,7 +1,8 @@ /* mpfr_round_raw_generic, mpfr_round_raw2, mpfr_round_raw, mpfr_prec_round, mpfr_can_round, mpfr_can_round_raw -- various rounding functions -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -88,7 +89,7 @@ mpfr_prec_round (mpfr_ptr x, mp_prec_t prec, mp_rnd_t rnd_mode) mp_exp_t exp = MPFR_EXP (x); if (MPFR_UNLIKELY(exp == __gmpfr_emax)) - (void) mpfr_set_overflow(x, rnd_mode, MPFR_SIGN(x)); + (void) mpfr_overflow(x, rnd_mode, MPFR_SIGN(x)); else { MPFR_ASSERTD (exp < __gmpfr_emax); @@ -1,6 +1,6 @@ /* mpfr_set -- copy of a floating-point number -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -58,7 +58,7 @@ mpfr_set4 (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode, int signb) /* Else Round B inside a */ MPFR_RNDRAW (inex, a, MPFR_MANT (b), MPFR_PREC (b), rnd_mode, signb, if (MPFR_UNLIKELY ( ++MPFR_EXP (a) > __gmpfr_emax)) - return mpfr_set_overflow (a, rnd_mode, signb) ); + return mpfr_overflow (a, rnd_mode, signb) ); MPFR_RET (inex); } } @@ -1,6 +1,6 @@ /* mpfr_set_q -- set a floating-point number from a multiple-precision rational -Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -103,14 +103,14 @@ mpfr_set_q (mpfr_ptr f, mpq_srcptr q, mp_rnd_t rnd) sn -= sd; if (MPFR_UNLIKELY (sn > MPFR_EMAX_MAX / BITS_PER_MP_LIMB)) { - inexact = mpfr_set_overflow (f, rnd, MPFR_SIGN (f)); + inexact = mpfr_overflow (f, rnd, MPFR_SIGN (f)); goto end; } if (MPFR_UNLIKELY (sn < MPFR_EMIN_MIN / BITS_PER_MP_LIMB -1)) { if (rnd == GMP_RNDN) rnd = GMP_RNDZ; - inexact = mpfr_set_underflow (f, rnd, MPFR_SIGN (f)); + inexact = mpfr_underflow (f, rnd, MPFR_SIGN (f)); goto end; } @@ -1,6 +1,6 @@ /* mpfr_set_si -- set a MPFR number from a machine signed integer -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -70,7 +70,7 @@ int { /* nbits is the current exponent */ if (MPFR_UNLIKELY((mp_exp_t) nbits == __gmpfr_emax)) - return mpfr_set_overflow(x, rnd_mode, (i < 0 ? -1 : 1)); + return mpfr_overflow(x, rnd_mode, (i < 0 ? -1 : 1)); MPFR_SET_EXP (x, nbits + 1); xp[xn] = MPFR_LIMB_HIGHBIT; } @@ -1,6 +1,6 @@ /* mpfr_set_sj -- set a MPFR number from a huge machine signed integer -Copyright 2004 Free Software Foundation. +Copyright 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -1,6 +1,6 @@ /* mpfr_set_ui -- set a MPFR number from a machine unsigned integer -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -67,7 +67,7 @@ mpfr_set_ui (mpfr_ptr x, unsigned long i, mp_rnd_t rnd_mode) { /* nbits is the current exponent */ if (MPFR_UNLIKELY((mp_exp_t) nbits == __gmpfr_emax)) - return mpfr_set_overflow(x, rnd_mode, 1); + return mpfr_overflow(x, rnd_mode, 1); MPFR_SET_EXP (x, nbits + 1); xp[xn] = MPFR_LIMB_HIGHBIT; @@ -1,6 +1,6 @@ /* mpfr_set_uj -- set a MPFR number from a huge machine unsigned integer -Copyright 2004 Free Software Foundation. +Copyright 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -94,17 +94,17 @@ mpfr_set_uj_2exp (mpfr_t x, uintmax_t j, intmax_t e, mp_rnd_t rnd) if (MPFR_UNLIKELY(e < __gmpfr_emin)) { /* The following test is necessary because in the rounding to the - * nearest mode, mpfr_set_underflow always rounds away from 0. In + * nearest mode, mpfr_underflow always rounds away from 0. In * this rounding mode, we need to round to 0 if: * _ |x| < 2^(emin-2), or * _ |x| = 2^(emin-2) and the absolute value of the exact * result is <= 2^(emin-2). */ if (rnd == GMP_RNDN && (e+1 < __gmpfr_emin || mpfr_powerof2_raw(y))) rnd = GMP_RNDZ; - return mpfr_set_underflow (x, rnd, MPFR_SIGN_POS); + return mpfr_underflow (x, rnd, MPFR_SIGN_POS); } if (MPFR_UNLIKELY(e > __gmpfr_emax)) - return mpfr_set_overflow (x, rnd, MPFR_SIGN_POS); + return mpfr_overflow (x, rnd, MPFR_SIGN_POS); MPFR_SET_EXP (y, e); /* Final: set x to y (rounding if necessary) */ @@ -1,6 +1,7 @@ /* mpfr_set_z -- set a floating-point number from a multiple-precision integer -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -51,7 +52,7 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode) count_leading_zeros (k, zp[zn-1]); if (MPFR_UNLIKELY (zn > MPFR_EMAX_MAX / BITS_PER_MP_LIMB + 1)) - return mpfr_set_overflow(f, rnd_mode, sign_z); + return mpfr_overflow(f, rnd_mode, sign_z); /* because zn >= __gmpfr_emax / BITS_PER_MP_LIMB + 2 and zn * BITS_PER_MP_LIMB >= __gmpfr_emax + BITS_PER_MP_LIMB + 1 and exp = zn * BITS_PER_MP_LIMB - k > __gmpfr_emax */ @@ -63,9 +64,9 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode) exp = (mp_prec_t) zn * BITS_PER_MP_LIMB - k; /* The exponent will be exp or exp + 1 (due to rounding) */ if (MPFR_UNLIKELY (exp > __gmpfr_emax)) - return mpfr_set_overflow (f, rnd_mode, sign_z); + return mpfr_overflow (f, rnd_mode, sign_z); if (MPFR_UNLIKELY (exp + 1 < __gmpfr_emin)) - return mpfr_set_underflow(f, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode, + return mpfr_underflow(f, rnd_mode == GMP_RNDN ? GMP_RNDZ : rnd_mode, sign_z); if (MPFR_LIKELY (dif >= 0)) @@ -145,7 +146,7 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode) { /* Pow 2 case */ if (MPFR_UNLIKELY (exp == __gmpfr_emax)) - return mpfr_set_overflow (f, rnd_mode, sign_z); + return mpfr_overflow (f, rnd_mode, sign_z); exp ++; fp[fn-1] = MPFR_LIMB_HIGHBIT; } @@ -167,7 +168,7 @@ mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mp_rnd_t rnd_mode) { if (rnd_mode == GMP_RNDN && inex == 0 && mpfr_powerof2_raw (f)) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow(f, rnd_mode, sign_z); + return mpfr_underflow(f, rnd_mode, sign_z); } MPFR_SET_EXP (f, exp); @@ -1,6 +1,6 @@ /* mpfr_sqr -- Floating square -Copyright 2004 Free Software Foundation, Inc. +Copyright 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -87,7 +87,7 @@ mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) { mp_exp_t ax2 = ax + (mp_exp_t) (b1 - 1 + cc); if (MPFR_UNLIKELY( ax2 > __gmpfr_emax)) - return mpfr_set_overflow (a, rnd_mode, MPFR_SIGN_POS); + return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS); if (MPFR_UNLIKELY( ax2 < __gmpfr_emin)) { /* In the rounding to the nearest mode, if the exponent of the exact @@ -97,7 +97,7 @@ mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode) if (rnd_mode == GMP_RNDN && (ax + (mp_exp_t) b1 < __gmpfr_emin || mpfr_powerof2_raw (b))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (a, rnd_mode, MPFR_SIGN_POS); + return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS); } MPFR_SET_EXP (a, ax2); MPFR_SET_POS (a); @@ -1,6 +1,6 @@ /* mpfr_strtofr -- set a floating-point number from a string -Copyright 2004 Free Software Foundation, Inc. +Copyright 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -664,11 +664,11 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd) (Real expo < MPFR_EXP_MIN << __gmpfr_emin */ if (rnd == GMP_RNDN) rnd = GMP_RNDZ; - res = mpfr_set_underflow (x, rnd, (pstr->negative) ? -1 : 1); + res = mpfr_underflow (x, rnd, (pstr->negative) ? -1 : 1); goto end; overflow: - res = mpfr_set_overflow (x, rnd, (pstr->negative) ? -1 : 1); + res = mpfr_overflow (x, rnd, (pstr->negative) ? -1 : 1); end: TMP_FREE (marker); @@ -703,14 +703,14 @@ mpfr_strtofr (mpfr_t x, const char *string, char **end, int base, free_parsed_string (&pstr); } else if (res == 2) - res = mpfr_set_overflow (x, rnd, (pstr.negative) ? -1 : 1); + res = mpfr_overflow (x, rnd, (pstr.negative) ? -1 : 1); else if (res == 3) { /* This is called when there is a huge overflow (Real expo < MPFR_EXP_MIN << __gmpfr_emin */ if (rnd == GMP_RNDN) rnd = GMP_RNDZ; - res = mpfr_set_underflow (x, rnd, (pstr.negative) ? -1 : 1); + res = mpfr_underflow (x, rnd, (pstr.negative) ? -1 : 1); } } if (end != NULL) @@ -495,7 +495,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) (exp_a < __gmpfr_emin - 1 || (inexact >= 0 && mpfr_powerof2_raw (a)))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (a, rnd_mode, MPFR_SIGN(a)); + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); } MPFR_SET_EXP (a, exp_a); } @@ -510,7 +510,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) if (MPFR_UNLIKELY(add_exp && exp_b == __gmpfr_emax)) { TMP_FREE(marker); - return mpfr_set_overflow (a, rnd_mode, MPFR_SIGN(a)); + return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a)); } MPFR_SET_EXP (a, exp_b + add_exp); } @@ -1,7 +1,7 @@ /* mpfr_sub1sp -- internal function to perform a "real" substraction All the op must have the same precision -Copyright 2003, 2004 Free Software Foundation. +Copyright 2003, 2004, 2005 Free Software Foundation. Contributed by the Spaces project, INRIA Lorraine. This file is part of the MPFR Library. @@ -228,7 +228,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) (bx < __gmpfr_emin - 1 || (/*inexact >= 0 &&*/ mpfr_powerof2_raw (a)))) rnd_mode = GMP_RNDZ; - return mpfr_set_underflow (a, rnd_mode, MPFR_SIGN(a)); + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); } MPFR_SET_EXP (a, bx); /* No rounding is necessary since the result is exact */ @@ -744,7 +744,7 @@ mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) (inexact >= 0 && mpfr_powerof2_raw (a)))) rnd_mode = GMP_RNDZ; TMP_FREE(marker); - return mpfr_set_underflow (a, rnd_mode, MPFR_SIGN(a)); + return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a)); } */ MPFR_SET_EXP (a, bx); diff --git a/sub_one_ulp.c b/sub_one_ulp.c index 8b300ef16..42ea1d9a6 100644 --- a/sub_one_ulp.c +++ b/sub_one_ulp.c @@ -1,6 +1,6 @@ /* mpfr_sub_one_ulp -- subtract one unit in last place -Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -47,7 +47,7 @@ mpfr_sub_one_ulp(mpfr_ptr x, mp_rnd_t rnd_mode) /* Note: In case of underflow and rounding to the nearest mode, x won't be changed. Beware of infinite loops! */ if (MPFR_UNLIKELY( exp == __gmpfr_emin )) - return mpfr_set_underflow(x, rnd_mode, MPFR_SIGN(x)); + return mpfr_underflow(x, rnd_mode, MPFR_SIGN(x)); else { mp_size_t i; diff --git a/tests/texceptions.c b/tests/texceptions.c index 6cb7daf68..72237d16a 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -194,7 +194,7 @@ test_set_underflow (void) int inex; j = s < 0 && i > 1 ? 5 - i : i; - inex = mpfr_set_underflow (x, (mp_rnd_t) i, s); + inex = mpfr_underflow (x, (mp_rnd_t) i, s); if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0) { printf ("Error in test_set_underflow, sign = %d," @@ -237,7 +237,7 @@ test_set_overflow (void) int inex; j = s < 0 && i > 1 ? 5 - i : i; - inex = mpfr_set_overflow (x, (mp_rnd_t) i, s); + inex = mpfr_overflow (x, (mp_rnd_t) i, s); if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0) { printf ("Error in test_set_overflow, sign = %d," |