summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/coth.c4
-rw-r--r--src/div.c2
-rw-r--r--src/erfc.c8
-rw-r--r--src/exp2.c2
-rw-r--r--src/get_si.c2
-rw-r--r--src/get_str.c2
-rw-r--r--src/jn.c2
-rw-r--r--src/lngamma.c2
-rw-r--r--src/mpfr-impl.h4
-rw-r--r--src/mpfr.h2
-rw-r--r--src/pow.c8
-rw-r--r--src/pow_si.c2
-rw-r--r--src/pow_z.c2
-rw-r--r--src/print_raw.c2
-rw-r--r--src/signbit.c2
-rw-r--r--src/sin.c2
-rw-r--r--src/sin_cos.c2
-rw-r--r--src/yn.c4
18 files changed, 27 insertions, 27 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; \
} \
}
diff --git a/src/div.c b/src/div.c
index dfec7d473..baeee9c92 100644
--- a/src/div.c
+++ b/src/div.c
@@ -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)))
{
diff --git a/src/jn.c b/src/jn.c
index 210f9d3ed..3ddd4dd77 100644
--- a/src/jn.c
+++ b/src/jn.c
@@ -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))
diff --git a/src/pow.c b/src/pow.c
index 45d1ff92a..e1317aa0a 100644
--- a/src/pow.c
+++ b/src/pow.c
@@ -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);
}
diff --git a/src/sin.c b/src/sin.c
index 354d3452e..71c310e98 100644
--- a/src/sin.c
+++ b/src/sin.c
@@ -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);
diff --git a/src/yn.c b/src/yn.c
index 5412db567..a6df3cee8 100644
--- a/src/yn.c
+++ b/src/yn.c
@@ -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;