diff options
49 files changed, 135 insertions, 135 deletions
diff --git a/src/coth.c b/src/coth.c index 3d751d7ca..a97fcf8f5 100644 --- a/src/coth.c +++ b/src/coth.c @@ -42,10 +42,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., if (MPFR_GET_EXP(z) == 1) /* 1 <= |z| < 2 */ \ { \ /* the following is exact by Sterbenz theorem */ \ - mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ + mpfr_sub_si (z, z, MPFR_SIGN (z), MPFR_RNDN); \ if (MPFR_IS_ZERO(z) || MPFR_GET_EXP(z) <= - (mpfr_exp_t) precy) \ { \ - mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \ + mpfr_add_si (z, z, MPFR_SIGN (z), MPFR_RNDN); \ break; \ } \ } @@ -251,7 +251,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) && vp[0] <= ULONG_MAX) { mpfr_exp_t exp_v = MPFR_EXP(v); /* save it in case q=v */ - if (MPFR_SIGN(v) > 0) + if (MPFR_IS_POS (v)) inex = mpfr_div_ui (q, u, vp[0], rnd_mode); else { diff --git a/src/erfc.c b/src/erfc.c index ebe5bfec4..ece7e8308 100644 --- a/src/erfc.c +++ b/src/erfc.c @@ -149,7 +149,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) return mpfr_set_ui (y, 1, rnd); } - if (MPFR_SIGN (x) > 0) + if (MPFR_IS_POS (x)) { /* by default, emin = 1-2^30, thus the smallest representable number is 1/2*2^emin = 2^(-2^30): @@ -168,7 +168,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) /* Init stuff */ MPFR_SAVE_EXPO_MARK (expo); - if (MPFR_SIGN (x) < 0) + if (MPFR_IS_NEG (x)) { mpfr_exp_t e = MPFR_EXP(x); /* For x < 0 going to -infinity, erfc(x) tends to 2 by below. @@ -220,7 +220,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) /* erfc(x) ~ 1, with error < 2^(EXP(x)+1) */ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, __gmpfr_one, - MPFR_GET_EXP (x) - 1, - 0, MPFR_SIGN(x) < 0, + 0, MPFR_IS_NEG (x), rnd, inex = _inexact; goto end); prec = MPFR_PREC (y) + MPFR_INT_CEIL_LOG2 (MPFR_PREC (y)) + 3; @@ -234,7 +234,7 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd) { /* use asymptotic formula only whenever x^2 >= p*log(2), otherwise it will not converge */ - if (MPFR_SIGN (x) > 0 && + if (MPFR_IS_POS (x) && 2 * MPFR_GET_EXP (x) - 2 >= MPFR_INT_CEIL_LOG2 (prec)) /* we have x^2 >= p in that case */ { diff --git a/src/exp2.c b/src/exp2.c index d1434d495..27e7b9f7f 100644 --- a/src/exp2.c +++ b/src/exp2.c @@ -87,7 +87,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) |2^x - 1| <= x < 2^EXP(x). If x > 0 we must round away from 0 (dir=1); if x < 0 we must round toward 0 (dir=0). */ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, - MPFR_GET_EXP (x), 0, - MPFR_SIGN(x) > 0, rnd_mode, expo, {}); + MPFR_IS_POS (x), rnd_mode, expo, {}); xint = mpfr_get_si (x, MPFR_RNDZ); mpfr_init2 (xfrac, MPFR_PREC (x)); diff --git a/src/get_si.c b/src/get_si.c index a0f14d440..fbbb4be5a 100644 --- a/src/get_si.c +++ b/src/get_si.c @@ -60,7 +60,7 @@ mpfr_get_si (mpfr_srcptr f, mpfr_rnd_t rnd) exp = MPFR_GET_EXP (x); /* since |x| >= 1, exp >= 1 */ n = MPFR_LIMB_SIZE(x); a = MPFR_MANT(x)[n - 1] >> (GMP_NUMB_BITS - exp); - s = MPFR_SIGN(f) > 0 ? a : a <= LONG_MAX ? - (long) a : LONG_MIN; + s = MPFR_IS_POS (f) ? a : a <= LONG_MAX ? - (long) a : LONG_MIN; } mpfr_clear (x); diff --git a/src/get_str.c b/src/get_str.c index f817dc9d8..91bcc1fa8 100644 --- a/src/get_str.c +++ b/src/get_str.c @@ -2278,7 +2278,7 @@ mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t return s; } - neg = MPFR_SIGN(x) < 0; /* 0 if positive, 1 if negative */ + neg = MPFR_IS_NEG (x); /* 0 if positive, 1 if negative */ if (MPFR_UNLIKELY (MPFR_IS_INF (x))) { @@ -197,7 +197,7 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) { /* the following is an upper 32-bit approximation to exp(1)/2 */ mpfr_set_str_binary (y, "1.0101101111110000101010001011001"); - if (MPFR_SIGN(z) > 0) + if (MPFR_IS_POS (z)) mpfr_mul (y, y, z, MPFR_RNDU); else { diff --git a/src/lngamma.c b/src/lngamma.c index 1fae27de7..7f059e161 100644 --- a/src/lngamma.c +++ b/src/lngamma.c @@ -76,7 +76,7 @@ mpfr_explgamma (mpfr_ptr y, mpfr_srcptr x, mpfr_save_expo_t *pexpo, /* s1 = RNDD(lngamma(x)), inexact */ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags1))) { - if (MPFR_SIGN (s1) > 0) + if (MPFR_IS_POS (s1)) { MPFR_SAVE_EXPO_UPDATE_FLAGS (*pexpo, MPFR_FLAGS_OVERFLOW); return mpfr_overflow (y, rnd, sign); diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h index f7360e96e..66150d48e 100644 --- a/src/mpfr-impl.h +++ b/src/mpfr-impl.h @@ -849,8 +849,8 @@ typedef intmax_t mpfr_eexp_t; #define MPFR_SIGN_POS (1) #define MPFR_SIGN_NEG (-1) -#define MPFR_IS_STRICTPOS(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x) > 0) -#define MPFR_IS_STRICTNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x) < 0) +#define MPFR_IS_STRICTPOS(x) (MPFR_NOTZERO (x) && MPFR_IS_POS (x)) +#define MPFR_IS_STRICTNEG(x) (MPFR_NOTZERO (x) && MPFR_IS_NEG (x)) #define MPFR_IS_NEG(x) (MPFR_SIGN(x) < 0) #define MPFR_IS_POS(x) (MPFR_SIGN(x) > 0) diff --git a/src/mpfr.h b/src/mpfr.h index c08171377..c344ce674 100644 --- a/src/mpfr.h +++ b/src/mpfr.h @@ -867,7 +867,7 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); #define mpfr_abs(a,b,r) mpfr_set4(a,b,r,1) #define mpfr_copysign(a,b,c,r) mpfr_set4(a,b,r,MPFR_SIGN(c)) #define mpfr_setsign(a,b,s,r) mpfr_set4(a,b,r,(s) ? -1 : 1) -#define mpfr_signbit(x) (MPFR_SIGN(x) < 0) +#define mpfr_signbit(x) (MPFR_IS_NEG (x)) #define mpfr_cmp(b, c) mpfr_cmp3(b, c, 1) #define mpfr_mul_2exp(y,x,n,r) mpfr_mul_2ui((y),(x),(n),(r)) #define mpfr_div_2exp(y,x,n,r) mpfr_div_2ui((y),(x),(n),(r)) @@ -562,7 +562,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) to round y*o(log2(x)) toward zero too; (ii) if x < 0, we first compute t = o(-x), with rounding toward 1, and then follow as in case (1). */ - if (MPFR_SIGN (x) > 0) + if (MPFR_IS_POS (x)) mpfr_log2 (t, x, MPFR_RNDZ); else { @@ -576,7 +576,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) if (overflow) { MPFR_LOG_MSG (("early overflow detection\n", 0)); - negative = MPFR_SIGN(x) < 0 && is_odd (y); + negative = MPFR_IS_NEG (x) && is_odd (y); return mpfr_overflow (z, rnd_mode, negative ? -1 : 1); } } @@ -619,7 +619,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) MPFR_LOG_MSG (("early underflow detection\n", 0)); return mpfr_underflow (z, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, - MPFR_SIGN (x) < 0 && is_odd (y) ? -1 : 1); + MPFR_IS_NEG (x) && is_odd (y) ? -1 : 1); } } @@ -703,7 +703,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) mpfr_clear (t); MPFR_CLEAR_FLAGS (); MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (z, __gmpfr_one, - err, 0, - (MPFR_SIGN (y) > 0) ^ (cmp_x_1 < 0), + (MPFR_IS_POS (y)) ^ (cmp_x_1 < 0), rnd_mode, expo, {}); } diff --git a/src/pow_si.c b/src/pow_si.c index f92ad5dbe..507ba166d 100644 --- a/src/pow_si.c +++ b/src/pow_si.c @@ -165,7 +165,7 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd) toward sign(x), to avoid spurious overflow or underflow, as in mpfr_pow_z. */ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ : - (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD); + (MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD); MPFR_ZIV_INIT (loop, Nt); for (;;) diff --git a/src/pow_z.c b/src/pow_z.c index dd9b85503..6d7ed902d 100644 --- a/src/pow_z.c +++ b/src/pow_z.c @@ -286,7 +286,7 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd) /* We will compute rnd(rnd1(1/x) ^ (-z)), where rnd1 is the rounding toward sign(x), to avoid spurious overflow or underflow. */ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ : - (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD); + (MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD); MPFR_ZIV_INIT (loop, Nt); for (;;) diff --git a/src/print_raw.c b/src/print_raw.c index 58996ca66..4c1866ad1 100644 --- a/src/print_raw.c +++ b/src/print_raw.c @@ -32,7 +32,7 @@ mpfr_fprint_binary (FILE *stream, mpfr_srcptr x) return; } - if (MPFR_SIGN (x) < 0) + if (MPFR_IS_NEG (x)) fprintf (stream, "-"); if (MPFR_IS_INF (x)) diff --git a/src/signbit.c b/src/signbit.c index 604b16bb2..eb46d078d 100644 --- a/src/signbit.c +++ b/src/signbit.c @@ -26,5 +26,5 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., int mpfr_signbit (mpfr_srcptr x) { - return MPFR_SIGN (x) < 0; + return MPFR_IS_NEG (x); } @@ -109,7 +109,7 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_div_2ui (c, c, 1, MPFR_RNDN); /* Since c approximates Pi with an error <= 2^(2-expx-m) <= 2^(-m), it suffices to check that c - |xr| >= 2^(2-m). */ - if (MPFR_SIGN (xr) > 0) + if (MPFR_IS_POS (xr)) mpfr_sub (c, c, xr, MPFR_RNDZ); else mpfr_add (c, c, xr, MPFR_RNDZ); diff --git a/src/sin_cos.c b/src/sin_cos.c index 9f2a016a5..8c425635e 100644 --- a/src/sin_cos.c +++ b/src/sin_cos.c @@ -147,7 +147,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_mul_2ui (c, c, 1, MPFR_RNDN); mpfr_remainder (xr, x, c, MPFR_RNDN); mpfr_div_2ui (c, c, 1, MPFR_RNDN); - if (MPFR_SIGN (xr) > 0) + if (MPFR_IS_POS (xr)) mpfr_sub (c, c, xr, MPFR_RNDZ); else mpfr_add (c, c, xr, MPFR_RNDZ); @@ -170,7 +170,7 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) 0. We choose to return +0 in that case. */ else if (MPFR_IS_INF (z)) { - if (MPFR_SIGN(z) > 0) + if (MPFR_IS_POS (z)) return mpfr_set_ui (res, 0, r); else /* y(n,-Inf) = NaN */ { @@ -193,7 +193,7 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r) /* for z < 0, y(n,z) is imaginary except when j(n,|z|) = 0, which we assume does not happen for a rational z. */ - if (MPFR_SIGN(z) < 0) + if (MPFR_IS_NEG (z)) { MPFR_SET_NAN (res); MPFR_RET_NAN; diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h index 594775156..3aa966850 100644 --- a/tests/mpfr-test.h +++ b/tests/mpfr-test.h @@ -135,7 +135,7 @@ mpfr_print_raw (mpfr_srcptr x) return; } - if (MPFR_SIGN (x) < 0) + if (MPFR_IS_NEG (x)) printf ("-"); if (MPFR_IS_INF (x)) diff --git a/tests/taway.c b/tests/taway.c index 09ca58cc2..6b6da0fa7 100644 --- a/tests/taway.c +++ b/tests/taway.c @@ -111,7 +111,7 @@ test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t), set_special (ref3, i/SPECIAL_MAX); inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -166,7 +166,7 @@ test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, set_special (op3, k); inexa = testfunc (res, op1, op2, op3, MPFR_RNDA); - r = MPFR_SIGN(res) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref, op1, op2, op3, r); if (mpfr_compare (res, ref) || inexa != inexd) @@ -214,7 +214,7 @@ test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t), ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb (); inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -257,7 +257,7 @@ testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t), ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb (); inexa = testfunc (res1, ref2, ref3, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); if (mpfr_compare (res1, ref1) || inexa != inexd) @@ -299,7 +299,7 @@ test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), const char *foo) /* first round to away */ inexa = testfunc (res1, ref2, MPFR_RNDA); - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, r); if (mpfr_compare (res1, ref1) || inexa != inexd) { @@ -344,7 +344,7 @@ test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), inexa = testfunc (res1, res2, ref3, MPFR_RNDA); /* first check wrt the first operand */ - r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res1) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); /* the low 2 bits of the inexact flag concern the 1st operand */ if (mpfr_compare (res1, ref1) || (inexa & 3) != (inexd & 3)) @@ -358,7 +358,7 @@ test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), } /* now check wrt the second operand */ - r = MPFR_SIGN(res2) > 0 ? MPFR_RNDU : MPFR_RNDD; + r = MPFR_IS_POS (res2) ? MPFR_RNDU : MPFR_RNDD; inexd = testfunc (ref1, ref2, ref3, r); /* bits 2..3 of the inexact flag concern the 2nd operand */ if (mpfr_compare (res2, ref2) || (inexa >> 2) != (inexd >> 2)) diff --git a/tests/tcos.c b/tests/tcos.c index 3ca51db44..b169c77ad 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -217,7 +217,7 @@ overflowed_cos0 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n" " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/tcosh.c b/tests/tcosh.c index 454ef9b08..48b80f36d 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -101,28 +101,28 @@ special (void) mpfr_clear_flags (); mpfr_set_str_binary (x, "1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDD); - MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_cosh (x, x, MPFR_RNDU); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); diff --git a/tests/tcoth.c b/tests/tcoth.c index 9d7bd6775..593ba1b65 100644 --- a/tests/tcoth.c +++ b/tests/tcoth.c @@ -60,14 +60,14 @@ check_specials (void) /* coth(+/-0) = +/-Inf */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_coth (y, x, MPFR_RNDN); - if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_inf_p (y) && MPFR_IS_POS (y))) { printf ("Error: coth(+0) != +Inf\n"); exit (1); } mpfr_neg (x, x, MPFR_RNDN); mpfr_coth (y, x, MPFR_RNDN); - if (! (mpfr_inf_p (y) && MPFR_SIGN (y) < 0)) + if (! (mpfr_inf_p (y) && MPFR_IS_NEG (y))) { printf ("Error: coth(-0) != -Inf\n"); exit (1); diff --git a/tests/tcsch.c b/tests/tcsch.c index b3cf327a3..5cf3b686d 100644 --- a/tests/tcsch.c +++ b/tests/tcsch.c @@ -44,7 +44,7 @@ check_specials (void) mpfr_set_inf (x, 1); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) >0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: csch(+Inf) != +0\n"); exit (1); @@ -52,7 +52,7 @@ check_specials (void) mpfr_set_inf (x, -1); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) <0)) + if (! (mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error: csch(-0) != -0\n"); exit (1); @@ -77,14 +77,14 @@ check_specials (void) /* check huge x */ mpfr_set_str (x, "8e8", 10, MPFR_RNDN); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: csch(8e8) != +0\n"); exit (1); } mpfr_set_str (x, "-8e8", 10, MPFR_RNDN); mpfr_csch (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error: csch(-8e8) != -0\n"); exit (1); diff --git a/tests/tdiv.c b/tests/tdiv.c index 14d7c91a8..583ac1b24 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -1076,7 +1076,7 @@ test_20070628 (void) mpfr_set_si_2exp (y, 1, -256, MPFR_RNDN); mpfr_clear_flags (); inex = mpfr_div (x, x, y, MPFR_RNDD); - if (MPFR_SIGN (x) >= 0 || ! mpfr_inf_p (x)) + if (MPFR_IS_POS (x) || ! mpfr_inf_p (x)) { printf ("Error in test_20070628: expected -Inf, got\n"); mpfr_dump (x); diff --git a/tests/texp.c b/tests/texp.c index 6d2618883..c01468c54 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -585,7 +585,7 @@ overflowed_exp0 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n" " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/texp10.c b/tests/texp10.c index ea9564fd1..181c730bd 100644 --- a/tests/texp10.c +++ b/tests/texp10.c @@ -169,7 +169,7 @@ overfl_exp10_0 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n" " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/texp2.c b/tests/texp2.c index a399f44ac..bb1cf1f7f 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -194,7 +194,7 @@ overflowed_exp2_0 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n" " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/texpm1.c b/tests/texpm1.c index d1babdd17..0f75844cc 100644 --- a/tests/texpm1.c +++ b/tests/texpm1.c @@ -103,21 +103,21 @@ special (void) mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); i = test_expm1 (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); i = test_expm1 (x, x, MPFR_RNDU); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "1.1E1000000000"); i = test_expm1 (x, x, MPFR_RNDD); - MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == -1); diff --git a/tests/tfactorial.c b/tests/tfactorial.c index 0ab2b558f..02d1c3555 100644 --- a/tests/tfactorial.c +++ b/tests/tfactorial.c @@ -167,7 +167,7 @@ overflowed_fac0 (void) mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_fac0 (rnd = %s):\n" " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/tfma.c b/tests/tfma.c index 3d2c11f29..90d898781 100644 --- a/tests/tfma.c +++ b/tests/tfma.c @@ -156,7 +156,7 @@ test_overflow2 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - else if (MPFR_SIGN (r) >= 0) + else if (MPFR_IS_POS (r)) { printf ("Error in test_overflow2 (i = %d, %s): wrong sign " "(+ instead of -)\n", i, diff --git a/tests/tfms.c b/tests/tfms.c index 2ae53ebf8..ba64ddbae 100644 --- a/tests/tfms.c +++ b/tests/tfms.c @@ -156,7 +156,7 @@ test_overflow2 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - else if (MPFR_SIGN (r) >= 0) + else if (MPFR_IS_POS (r)) { printf ("Error in test_overflow2 (i = %d, %s): wrong sign " "(+ instead of -)\n", i, diff --git a/tests/tgamma.c b/tests/tgamma.c index 3ce7e6a05..d4ec9ae27 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -222,7 +222,7 @@ special_overflow (void) mpfr_set_prec (y, 29); mpfr_set_str (x, "-200000000.5", 10, MPFR_RNDN); /* exact */ mpfr_gamma (y, x, MPFR_RNDN); - if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (!(mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error for gamma(-200000000.5)\n"); printf ("expected -0"); @@ -235,7 +235,7 @@ special_overflow (void) mpfr_set_prec (y, 53); mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN); mpfr_gamma (y, x, MPFR_RNDN); - if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (!(mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error for gamma(-200000000.1), prec=53\n"); printf ("expected -0"); @@ -349,7 +349,7 @@ special_overflow (void) mpfr_set_prec (y, 71); mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN); mpfr_gamma (y, x, MPFR_RNDN); - if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0)) + if (!(mpfr_zero_p (y) && MPFR_IS_NEG (y))) { printf ("Error for gamma (test 8)\n"); printf ("expected "); mpfr_dump (x); diff --git a/tests/tget_flt.c b/tests/tget_flt.c index 2a81b9d5e..87f535f08 100644 --- a/tests/tget_flt.c +++ b/tests/tget_flt.c @@ -92,7 +92,7 @@ main (void) mpfr_set_ui (x, 0, MPFR_RNDN); f = mpfr_get_flt (x, MPFR_RNDN); mpfr_set_flt (x, f, MPFR_RNDN); - if (mpfr_zero_p (x) == 0 || MPFR_SIGN (x) < 0) + if (mpfr_zero_p (x) == 0 || MPFR_IS_NEG (x)) { printf ("Error for mpfr_set_flt(mpfr_get_flt(+0))\n"); exit (1); @@ -103,7 +103,7 @@ main (void) mpfr_neg (x, x, MPFR_RNDN); f = mpfr_get_flt (x, MPFR_RNDN); mpfr_set_flt (x, f, MPFR_RNDN); - if (mpfr_zero_p (x) == 0 || MPFR_SIGN (x) > 0) + if (mpfr_zero_p (x) == 0 || MPFR_IS_POS (x)) { printf ("Error for mpfr_set_flt(mpfr_get_flt(-0))\n"); exit (1); diff --git a/tests/tgmpop.c b/tests/tgmpop.c index 96b66f3ef..62a18977f 100644 --- a/tests/tgmpop.c +++ b/tests/tgmpop.c @@ -110,36 +110,36 @@ special (void) mpq_set_ui (q, 1, 0); mpfr_set_str1 (x, "0.5"); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); mpq_set_si (q, -1, 0); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); res = mpfr_div_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_IS_NEG (y) && res == 0); mpq_set_ui (q, 1, 0); mpfr_set_inf (x, 1); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("+Inf + +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("+Inf + +Inf", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); CHECK_FOR ("+Inf - +Inf", MPFR_IS_NAN (y) && res == 0); mpfr_set_inf (x, -1); res = mpfr_add_q (y, x, q, MPFR_RNDN); CHECK_FOR ("-Inf + +Inf", MPFR_IS_NAN (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("-Inf - +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("-Inf - +Inf", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); mpq_set_si (q, -1, 0); mpfr_set_inf (x, 1); res = mpfr_add_q (y, x, q, MPFR_RNDN); CHECK_FOR ("+Inf + -Inf", MPFR_IS_NAN (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("+Inf - -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("+Inf - -Inf", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0); mpfr_set_inf (x, -1); res = mpfr_add_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("-Inf + -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + CHECK_FOR ("-Inf + -Inf", mpfr_inf_p (y) && MPFR_IS_NEG (y) && res == 0); res = mpfr_sub_q (y, x, q, MPFR_RNDN); CHECK_FOR ("-Inf - -Inf", MPFR_IS_NAN (y) && res == 0); @@ -151,15 +151,15 @@ special (void) res = mpfr_sub_q (y, x, q, MPFR_RNDN); CHECK_FOR ("42-0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0); res = mpfr_mul_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_SIGN (y) > 0 && res == 0); + CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_IS_POS (y) && res == 0); mpfr_clear_flags (); res = mpfr_div_q (y, x, q, MPFR_RNDN); - CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0 + CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0 && mpfr_divby0_p ()); mpz_set_ui (z, 0); mpfr_clear_flags (); res = mpfr_div_z (y, x, z, MPFR_RNDN); - CHECK_FORZ ("42/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0 + CHECK_FORZ ("42/0", mpfr_inf_p (y) && MPFR_IS_POS (y) && res == 0 && mpfr_divby0_p ()); mpz_clear (z); diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c index 061b49a52..9d0eb7022 100644 --- a/tests/thyperbolic.c +++ b/tests/thyperbolic.c @@ -217,13 +217,13 @@ check_INF (void) MPFR_SET_INF(t); - if(MPFR_SIGN(t)<0) + if(MPFR_IS_NEG (t)) MPFR_CHANGE_SIGN(t); /******cosh********/ tester = mpfr_cosh(ch,t,MPFR_RNDD); - if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0) + if (!MPFR_IS_INF(ch) || MPFR_IS_NEG (ch) || tester!=0) { printf("cosh(INF) \n"); fail = 1; @@ -233,7 +233,7 @@ check_INF (void) /******sinh********/ tester=mpfr_sinh(sh,t,MPFR_RNDD); - if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0) + if (!MPFR_IS_INF(sh) || MPFR_IS_NEG (sh) || tester!=0) { printf("sinh(INF) \n"); fail = 1; @@ -253,7 +253,7 @@ check_INF (void) /******acosh********/ tester=mpfr_acosh(ach,t,MPFR_RNDD); - if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0) + if (!MPFR_IS_INF(ach) || MPFR_IS_NEG (ach) || tester!=0) { printf("acosh(INF) \n"); fail = 1; @@ -263,7 +263,7 @@ check_INF (void) /******asinh********/ tester=mpfr_asinh(ash,t,MPFR_RNDD); - if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0) + if (!MPFR_IS_INF(ash) || MPFR_IS_NEG (ash) || tester!=0) { printf("asinh(INF) \n"); fail = 1; @@ -285,7 +285,7 @@ check_INF (void) /******cosh********/ tester=mpfr_cosh(ch,t,MPFR_RNDD); - if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0) + if (!MPFR_IS_INF(ch) || MPFR_IS_NEG (ch) || tester!=0) { printf("cosh(-INF) \n"); fail = 1; @@ -295,7 +295,7 @@ check_INF (void) /******sinh********/ tester=mpfr_sinh(sh,t,MPFR_RNDD); - if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0) + if (!MPFR_IS_INF(sh) || MPFR_IS_POS (sh) || tester!=0) { printf("sinh(-INF) \n"); fail = 1; @@ -325,7 +325,7 @@ check_INF (void) /******asinh********/ tester=mpfr_asinh(ash,t,MPFR_RNDD); - if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0) + if (!MPFR_IS_INF(ash) || MPFR_IS_POS (ash) || tester!=0) { printf("asinh(-INF) \n"); fail = 1; diff --git a/tests/tpow.c b/tests/tpow.c index 5251e142c..4e8e0f5dc 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -130,7 +130,7 @@ check_pow_ui (void) /* Check overflow */ mpfr_set_str_binary (a, "1E10"); res = mpfr_pow_ui (a, a, ULONG_MAX, MPFR_RNDN); - if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0) + if (!MPFR_IS_INF (a) || MPFR_IS_NEG (a)) { printf ("Error for (1e10)^ULONG_MAX\n"); exit (1); @@ -143,7 +143,7 @@ check_pow_ui (void) mpfr_set_str_binary (a, "-1E10"); n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1; res = mpfr_pow_ui (a, a, n, MPFR_RNDN); - if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0) + if (!MPFR_IS_INF (a) || MPFR_IS_POS (a)) { printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n); mpfr_dump (a); @@ -1250,7 +1250,7 @@ bug20071103 (void) mpfr_set_exp (y, mpfr_get_emax ()); mpfr_clear_flags (); mpfr_pow (z, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_SIGN (z) > 0 && + MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_IS_POS (z) && __gmpfr_flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT)); mpfr_clears (x, y, z, (mpfr_ptr) 0); @@ -1277,7 +1277,7 @@ bug20071104 (void) mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */ mpfr_clear_flags (); inex = mpfr_pow (z, x, y, MPFR_RNDN); - if (! mpfr_inf_p (z) || MPFR_SIGN (z) < 0) + if (! mpfr_inf_p (z) || MPFR_IS_NEG (z)) { printf ("Error in bug20071104: expected +Inf, got "); mpfr_dump (z); @@ -1373,7 +1373,7 @@ bug20071128 (void) mpfr_set_si_2exp (y, -1, i, MPFR_RNDN); mpfr_add_si (y, y, 1, MPFR_RNDN); tern = mpfr_pow (z, x, y, MPFR_RNDN); - MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0); + MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_IS_NEG (z)); } mpfr_clear (x); diff --git a/tests/tpow_z.c b/tests/tpow_z.c index d6585eae1..b15485a41 100644 --- a/tests/tpow_z.c +++ b/tests/tpow_z.c @@ -76,59 +76,59 @@ check_special (void) mpz_set_si (z, -42); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("INF^-42"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("-INF^-42"); mpz_set_si (z, -17); mpfr_set_inf (x, 1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("INF^-17"); mpfr_set_inf (x, -1); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_POS (y)) ERROR ("-INF^-17"); /* s0^N = +0 if s==+ or n even if N > 0*/ mpz_set_ui (z, 42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("+0^42"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("-0^42"); mpz_set_ui (z, 17); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("+0^17"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0) + if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_IS_POS (y)) ERROR ("-0^17"); mpz_set_si (z, -42); MPFR_SET_ZERO (x); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("+0^-42"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("-0^-42"); mpz_set_si (z, -17); MPFR_SET_POS (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0) + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_NEG (y)) ERROR ("+0^-17"); MPFR_SET_NEG (x); res = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) >= 0) + if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_IS_POS (y)) ERROR ("-0^-17"); mpz_clear (z); @@ -236,7 +236,7 @@ bug20071104 (void) mpfr_nextbelow (x); /* x = -2^(emin-1) */ mpfr_clear_flags (); inex = mpfr_pow_z (y, x, z, MPFR_RNDN); - if (! mpfr_inf_p (y) || MPFR_SIGN (y) < 0) + if (! mpfr_inf_p (y) || MPFR_IS_NEG (y)) { printf ("Error in bug20071104: expected +Inf, got "); mpfr_dump (y); @@ -270,7 +270,7 @@ check_overflow (void) mpfr_set_str_binary (a, "1E10"); mpz_init_set_ui (z, ULONG_MAX); res = mpfr_pow_z (a, a, z, MPFR_RNDN); - if (! MPFR_IS_INF (a) || MPFR_SIGN (a) < 0 || res <= 0) + if (! MPFR_IS_INF (a) || MPFR_IS_NEG (a) || res <= 0) { printf ("Error for (1e10)^ULONG_MAX, expected +Inf,\ngot "); mpfr_dump (a); @@ -286,7 +286,7 @@ check_overflow (void) n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1; mpz_set_ui (z, n); res = mpfr_pow_z (a, a, z, MPFR_RNDN); - if (! MPFR_IS_INF (a) || MPFR_SIGN (a) > 0 || res >= 0) + if (! MPFR_IS_INF (a) || MPFR_IS_POS (a) || res >= 0) { printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n); mpfr_dump (a); diff --git a/tests/tremquo.c b/tests/tremquo.c index ac3aa2948..73ea85f28 100644 --- a/tests/tremquo.c +++ b/tests/tremquo.c @@ -386,21 +386,21 @@ main (int argc, char *argv[]) mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_remainder (r, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_SIGN (r) < 0); + MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_IS_NEG (r)); /* check argument reuse */ mpfr_set_si (x, -1, MPFR_RNDN); mpfr_set_ui (y, 1, MPFR_RNDN); mpfr_remainder (x, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_IS_NEG (x)); mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN); mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN); mpfr_remquo (r, q, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_SIGN (r) > 0); + MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == 0); mpfr_fmodquo (r, q, x, y, MPFR_RNDN); - MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_SIGN (r) > 0); + MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_IS_POS (r)); MPFR_ASSERTN (q[0] == 0); mpfr_clear (x); diff --git a/tests/trint.c b/tests/trint.c index 3293b6cde..196b5ac8b 100644 --- a/tests/trint.c +++ b/tests/trint.c @@ -360,9 +360,9 @@ main (int argc, char *argv[]) if (inexact == 0) continue; /* end of the test for exact results */ - if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_SIGN (x) > 0)) + if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_IS_POS (x))) && inexact > 0) || - ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_SIGN (x) < 0)) + ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_IS_NEG (x))) && inexact < 0)) err ("wrong rounding direction", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); @@ -418,8 +418,8 @@ main (int argc, char *argv[]) else { /* halfway case for mpfr_round: x must have been rounded away from zero. */ - if ((MPFR_SIGN (x) > 0 && inexact < 0) || - (MPFR_SIGN (x) < 0 && inexact > 0)) + if ((MPFR_IS_POS (x) && inexact < 0) || + (MPFR_IS_NEG (x) && inexact > 0)) err ("halfway case for mpfr_round, bad rounding" " direction", s, x, y, p, (mpfr_rnd_t) r, trint, inexact); } diff --git a/tests/tsec.c b/tests/tsec.c index a0aacf99e..e0c533183 100644 --- a/tests/tsec.c +++ b/tests/tsec.c @@ -135,7 +135,7 @@ overflowed_sec0 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n" " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/tsech.c b/tests/tsech.c index 80e28ed50..932608e39 100644 --- a/tests/tsech.c +++ b/tests/tsech.c @@ -45,7 +45,7 @@ check_specials (void) mpfr_set_inf (x, 1); mpfr_sech (y, x, MPFR_RNDN); - if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0)) + if (! (MPFR_IS_ZERO (y) && MPFR_IS_POS (y))) { printf ("Error: sech(+Inf) != +0\n"); exit (1); @@ -53,7 +53,7 @@ check_specials (void) mpfr_set_inf (x, -1); mpfr_sech (y, x, MPFR_RNDN); - if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0)) + if (! (MPFR_IS_ZERO (y) && MPFR_IS_POS (y))) { printf ("Error: sech(-Inf) != +0\n"); exit (1); @@ -78,14 +78,14 @@ check_specials (void) /* check huge x */ mpfr_set_str (x, "8e8", 10, MPFR_RNDN); mpfr_sech (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: sech(8e8) != +0\n"); exit (1); } mpfr_set_str (x, "-8e8", 10, MPFR_RNDN); mpfr_sech (y, x, MPFR_RNDN); - if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_zero_p (y) && MPFR_IS_POS (y))) { printf ("Error: sech(-8e8) != +0\n"); exit (1); @@ -154,7 +154,7 @@ overflowed_sech0 (void) i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0)) + if (! (mpfr_inf_p (x) && MPFR_IS_POS (x))) { printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n" " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); diff --git a/tests/tset.c b/tests/tset.c index 6da3741ca..82e7f04c8 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -179,7 +179,7 @@ main (void) mpfr_set_str_binary (x, "0.111"); mpfr_set_prec (y, 2); mpfr_set (y, x, MPFR_RNDU); - if (!(MPFR_IS_INF (y) && MPFR_SIGN (y) > 0)) + if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y))) { printf ("Error for y=x=0.111 with px=3, py=2 and emax=0\nx="); mpfr_dump (x); diff --git a/tests/tset_ld.c b/tests/tset_ld.c index e7e031db3..53b27778b 100644 --- a/tests/tset_ld.c +++ b/tests/tset_ld.c @@ -406,7 +406,7 @@ main (int argc, char *argv[]) /* check that the sign of -0.0 is set */ mpfr_set_ld (x, DBL_NEG_ZERO, MPFR_RNDN); - if (MPFR_SIGN(x) > 0) + if (MPFR_IS_POS (x)) { #if _GMP_IEEE_FLOATS printf ("Error: sign of -0.0 is not set correctly\n"); diff --git a/tests/tset_str.c b/tests/tset_str.c index f0f661301..c0ea569c9 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -284,21 +284,21 @@ main (int argc, char *argv[]) /* if (mpfr_set_str (x, "@Inf@garbage", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on @Inf@garbage\n"); exit (1); } if (mpfr_set_str (x, "-@Inf@garbage", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) > 0) + !mpfr_inf_p(x) || MPFR_IS_POS (x)) { printf ("mpfr_set_str failed on -@Inf@garbage\n"); exit (1); } if (mpfr_set_str (x, "+@Inf@garbage", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on +@Inf@garbage\n"); exit (1); @@ -316,21 +316,21 @@ main (int argc, char *argv[]) } if (mpfr_set_str (x, "Inf", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on Inf\n"); exit (1); } if (mpfr_set_str (x, "-Inf", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) > 0) + !mpfr_inf_p(x) || MPFR_IS_POS (x)) { printf ("mpfr_set_str failed on -Inf\n"); exit (1); } if (mpfr_set_str (x, "+Inf", i, MPFR_RNDN) != 0 || - !mpfr_inf_p(x) || MPFR_SIGN(x) < 0) + !mpfr_inf_p(x) || MPFR_IS_NEG (x)) { printf ("mpfr_set_str failed on +Inf\n"); exit (1); diff --git a/tests/tsin.c b/tests/tsin.c index 7b0dcf638..a6bb7895d 100644 --- a/tests/tsin.c +++ b/tests/tsin.c @@ -107,7 +107,7 @@ test_sign (void) mpfr_set_prec (x, p); mpfr_mul_ui (x, pid, k, MPFR_RNDD); test_sin (y, x, MPFR_RNDN); - if (MPFR_SIGN(y) > 0) + if (MPFR_IS_POS (y)) { printf ("Error in test_sign for sin(%dpi-epsilon), prec = %d" " for argument.\nResult should have been negative.\n", @@ -116,7 +116,7 @@ test_sign (void) } mpfr_mul_ui (x, piu, k, MPFR_RNDU); test_sin (y, x, MPFR_RNDN); - if (MPFR_SIGN(y) < 0) + if (MPFR_IS_NEG (y)) { printf ("Error in test_sign for sin(%dpi+epsilon), prec = %d" " for argument.\nResult should have been positive.\n", diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c index 8e8787a4a..ff5acaf4d 100644 --- a/tests/tsin_cos.c +++ b/tests/tsin_cos.c @@ -194,7 +194,7 @@ overflowed_sin_cos0 (void) mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_zero_p (x) && MPFR_SIGN (x) < 0)) + if (! (mpfr_zero_p (x) && MPFR_IS_NEG (x))) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" " Got sin = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); @@ -230,7 +230,7 @@ overflowed_sin_cos0 (void) mpfr_print_rnd_mode ((mpfr_rnd_t) rnd)); err = 1; } - if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0)) + if (! (mpfr_inf_p (y) && MPFR_IS_POS (y))) { printf ("Error in overflowed_sin_cos0 (rnd = %s):\n" " Got cos = ", diff --git a/tests/tsinh.c b/tests/tsinh.c index 4bdf30b5a..cba8d810e 100644 --- a/tests/tsinh.c +++ b/tests/tsinh.c @@ -60,28 +60,28 @@ special (void) mpfr_clear_flags (); mpfr_set_str_binary (x, "1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_POS (x)); MPFR_ASSERTN (mpfr_overflow_p ()); MPFR_ASSERTN (i == 1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDN); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_NEG (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDD); - MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_IS_NEG (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == -1); mpfr_clear_flags (); mpfr_set_str_binary (x, "-1E1000000000"); i = mpfr_sinh (x, x, MPFR_RNDU); - MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) < 0); + MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_IS_NEG (x)); MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ()); MPFR_ASSERTN (i == 1); diff --git a/tests/tzeta.c b/tests/tzeta.c index 809a410b1..06282465b 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -248,7 +248,7 @@ main (int argc, char *argv[]) mpfr_set_ui (s, 1, MPFR_RNDN); mpfr_clear_divby0(); mpfr_zeta (z, s, MPFR_RNDN); - if (!mpfr_inf_p (z) || MPFR_SIGN (z) < 0 || !mpfr_divby0_p()) + if (!mpfr_inf_p (z) || MPFR_IS_NEG (z) || !mpfr_divby0_p()) { printf ("Error in mpfr_zeta for s = 1 (should be +inf) with divby0 flag\n"); exit (1); @@ -340,14 +340,14 @@ main (int argc, char *argv[]) mpfr_set_str (s, "-400000001", 10, MPFR_RNDZ); mpfr_zeta (z, s, MPFR_RNDN); - if (!(mpfr_inf_p (z) && MPFR_SIGN(z) < 0)) + if (!(mpfr_inf_p (z) && MPFR_IS_NEG (z))) { printf ("Error in mpfr_zeta (-400000001)\n"); exit (1); } mpfr_set_str (s, "-400000003", 10, MPFR_RNDZ); mpfr_zeta (z, s, MPFR_RNDN); - if (!(mpfr_inf_p (z) && MPFR_SIGN(z) > 0)) + if (!(mpfr_inf_p (z) && MPFR_IS_POS (z))) { printf ("Error in mpfr_zeta (-400000003)\n"); exit (1); @@ -385,7 +385,7 @@ main (int argc, char *argv[]) mpfr_set_prec (z, 128); mpfr_set_str_binary (s, "-0.1000000000000000000000000000000000000000000000000000000000000001E64"); inex = mpfr_zeta (z, s, MPFR_RNDN); - MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_SIGN (z) < 0 && inex < 0); + MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_IS_NEG (z) && inex < 0); inex = mpfr_zeta (z, s, MPFR_RNDU); mpfr_set_inf (s, -1); mpfr_nextabove (s); |