diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/get_version.c | 2 | ||||
-rw-r--r-- | src/inp_str.c | 12 | ||||
-rw-r--r-- | src/mpc-impl.h | 12 | ||||
-rw-r--r-- | src/mpc.h | 2 | ||||
-rw-r--r-- | src/mul_i.c | 6 | ||||
-rw-r--r-- | src/pow.c | 22 |
6 files changed, 28 insertions, 28 deletions
diff --git a/src/get_version.c b/src/get_version.c index 92368f3..49c867c 100644 --- a/src/get_version.c +++ b/src/get_version.c @@ -24,5 +24,5 @@ MA 02111-1307, USA. */ const char * mpc_get_version (void) { - return "0.7-dev"; + return "0.7"; } diff --git a/src/inp_str.c b/src/inp_str.c index 7adac05..621679a 100644 --- a/src/inp_str.c +++ b/src/inp_str.c @@ -110,14 +110,14 @@ extract_string (FILE *stream) /* (n-char-sequence) only after a NaN */ if ((nread != 3 - || tolower (str[0]) != 'n' - || tolower (str[1]) != 'a' - || tolower (str[2]) != 'n') + || tolower ((unsigned char) (str[0])) != 'n' + || tolower ((unsigned char) (str[1])) != 'a' + || tolower ((unsigned char) (str[2])) != 'n') && (nread != 5 || str[0] != '@' - || tolower (str[1]) != 'n' - || tolower (str[2]) != 'a' - || tolower (str[3]) != 'n' + || tolower ((unsigned char) (str[1])) != 'n' + || tolower ((unsigned char) (str[2])) != 'a' + || tolower ((unsigned char) (str[3])) != 'n' || str[4] != '@')) { ungetc (c, stream); return str; diff --git a/src/mpc-impl.h b/src/mpc-impl.h index b2c5ebe..de64752 100644 --- a/src/mpc-impl.h +++ b/src/mpc-impl.h @@ -83,16 +83,16 @@ MA 02111-1307, USA. */ #define INV_RND(r) \ (((r) == GMP_RNDU) ? GMP_RNDD : (((r) == GMP_RNDD) ? GMP_RNDU : (r))) -/* Convention in C99 (G.3): z is regarded as an infinity if at least one of - its parts is infinite */ #define mpc_inf_p(z) (mpfr_inf_p(MPC_RE(z))||mpfr_inf_p(MPC_IM(z))) -/* Convention in C99 (G.3): z is regarded as a zero if each of its parts is - a zero */ + /* Convention in C99 (G.3): z is regarded as an infinity if at least one of + its parts is infinite */ #define mpc_zero_p(z) (mpfr_zero_p(MPC_RE(z))&&mpfr_zero_p(MPC_IM(z))) -/* Convention in C99 (G.3): z is regarded as finite if both its parts are */ + /* Convention in C99 (G.3): z is regarded as a zero if each of its parts is + a zero */ #define mpc_fin_p(z) (mpfr_number_p(MPC_RE(z))&&mpfr_number_p(MPC_IM(z))) -/* Consider as NaN all other numbers */ + /* Convention in C99 (G.3): z is regarded as finite if both its parts are */ #define mpc_nan_p(z) ((mpfr_nan_p(MPC_RE(z)) && !mpfr_inf_p(MPC_IM(z))) || (mpfr_nan_p(MPC_IM(z)) && !mpfr_inf_p(MPC_RE(z)))) + /* Consider as NaN all other numbers containing at least one NaN */ #define OUT(x) \ @@ -29,7 +29,7 @@ MA 02111-1307, USA. */ #define MPC_VERSION_MAJOR 0 #define MPC_VERSION_MINOR 7 #define MPC_VERSION_PATCHLEVEL 0 -#define MPC_VERSION_STRING "0.7-dev" +#define MPC_VERSION_STRING "0.7" /* Macros dealing with MPC VERSION */ #define MPC_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) diff --git a/src/mul_i.c b/src/mul_i.c index b59f511..9c72170 100644 --- a/src/mul_i.c +++ b/src/mul_i.c @@ -1,4 +1,4 @@ -/* mpc_mul_si -- Multiply a complex number by plus or minus i. +/* mpc_mul_i -- Multiply a complex number by plus or minus i. Copyright (C) 2005, 2009 Andreas Enge, Philippe Th\'eveny @@ -76,6 +76,6 @@ mpc_mul_i (mpc_ptr a, mpc_srcptr b, int sign, mpc_rnd_t rnd) inex_im = mpfr_neg (MPC_IM (a), MPC_RE (b), MPC_RND_IM (rnd)); } } - - return MPC_INEX(inex_re, inex_im); + + return MPC_INEX(inex_re, inex_im); } @@ -49,7 +49,7 @@ MA 02111-1307, USA. */ whether c = -b^2, i.e., if -c is a square. Case 3: b = 0. Then d is necessarily zero, thus it suffices to check - whether c = a^2, i.e., if c is a square. + whether c = a^2, i.e., if c is a square. */ static int mpc_perfect_square_p (mpz_t a, mpz_t b, mpz_t c, mpz_t d) @@ -183,11 +183,11 @@ mpc_pow_exact (mpc_ptr z, mpc_srcptr x, mpfr_srcptr y, mpc_rnd_t rnd, } else /* neither c nor d is zero */ { - unsigned long u; + unsigned long v; t = mpz_scan1 (c, 0); - u = mpz_scan1 (d, 0); - if (u < t) - t = u; + v = mpz_scan1 (d, 0); + if (v < t) + t = v; mpz_div_2exp (c, c, t); mpz_div_2exp (d, d, t); ec += t; @@ -355,7 +355,7 @@ mpc_pow_exact (mpc_ptr z, mpc_srcptr x, mpfr_srcptr y, mpc_rnd_t rnd, /* Return 1 if y*2^k is an odd integer, 0 otherwise. Adapted from MPFR, file pow.c. - + Examples: with k=0, check if y is an odd integer, with k=1, check if y is half-an-integer, with k=-1, check if y/2 is an odd integer. @@ -430,7 +430,7 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd) mpfr_t n; int inex, cx1; int sign_zi; - /* cx1 < 0 if |x| < 1 + /* cx1 < 0 if |x| < 1 cx1 = 0 if |x| = 1 cx1 > 0 if |x| > 1 */ @@ -441,7 +441,7 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd) cx1 = -inex; sign_zi = (cx1 < 0 && mpfr_signbit (MPC_IM (y)) == 0) - || (cx1 == 0 + || (cx1 == 0 && mpfr_signbit (MPC_IM (x)) != mpfr_signbit (MPC_RE (y))) || (cx1 > 0 && mpfr_signbit (MPC_IM (y))); @@ -492,7 +492,7 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd) ret = mpc_set_ui (z, +1, rnd); /* the sign of the zero imaginary part is known in some cases (see - algorithm.tex). In such cases we have + algorithm.tex). In such cases we have (x +s*0i)^(y+/-0i) = x^y + s*sign(y)*0i where s = +/-1. We extend here this rule to fix the sign of the zero part. @@ -671,7 +671,7 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd) mpfr_t n; int inex, cx1; int sign_zi; - /* cx1 < 0 if |x| < 1 + /* cx1 < 0 if |x| < 1 cx1 = 0 if |x| = 1 cx1 > 0 if |x| > 1 */ @@ -682,7 +682,7 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd) cx1 = -inex; sign_zi = (cx1 < 0 && mpfr_signbit (MPC_IM (y)) == 0) - || (cx1 == 0 + || (cx1 == 0 && mpfr_signbit (MPC_IM (x)) != mpfr_signbit (MPC_RE (y))) || (cx1 > 0 && mpfr_signbit (MPC_IM (y))); |