diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-02-23 19:33:27 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-02-23 19:33:27 +0000 |
commit | 55981426f41a07c1de243772a32f071f8f66c6c4 (patch) | |
tree | db0962e11d02629d3c8b074920b3ca038aa74608 /src/sin_cos.c | |
parent | efe6418012b69c8b9081648660d5158fc91221f5 (diff) | |
download | mpc-55981426f41a07c1de243772a32f071f8f66c6c4.tar.gz |
mpc-impl.h, get_version.c:
declare and define functions mpfr_set_zero and mpfr_regular_p when
compiling with mpfr<3
sin_cos.c, fma.c: use these functions
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@961 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/sin_cos.c')
-rw-r--r-- | src/sin_cos.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/sin_cos.c b/src/sin_cos.c index 6a9d83b..b2cede1 100644 --- a/src/sin_cos.c +++ b/src/sin_cos.c @@ -185,7 +185,6 @@ mpc_sin_cos_real (mpc_ptr rop_sin, mpc_ptr rop_cos, mpc_srcptr op, by definition, for not computed values. */ mpfr_t s, c; int inex_s, inex_c; - int sign_im_op = mpfr_signbit (MPC_IM (op)); /* sin(x +-0*i) = sin(x) +-0*i*sign(cos(x)) */ /* cos(x +-i*0) = cos(x) -+i*0*sign(sin(x)) */ @@ -206,26 +205,17 @@ mpc_sin_cos_real (mpc_ptr rop_sin, mpc_ptr rop_cos, mpc_srcptr op, if (rop_sin != NULL) { mpfr_set (MPC_RE (rop_sin), s, GMP_RNDN); /* exact */ inex_sin_re = inex_s; - mpfr_set_ui (MPC_IM (rop_sin), 0ul, GMP_RNDN); - if ( ( sign_im_op && !mpfr_signbit (c)) - || (!sign_im_op && mpfr_signbit (c))) - MPFR_CHANGE_SIGN (MPC_IM (rop_sin)); - /* FIXME: simpler implementation with mpfr-3: - mpfr_set_zero (MPC_IM (rop_sin), - ( ( mpfr_signbit (MPC_IM(op)) && !mpfr_signbit(c)) - || (!mpfr_signbit (MPC_IM(op)) && mpfr_signbit(c)) ? -1 : 1); - there is no need to use the variable sign_im_op then, needed now in - the case rop_sin == op */ + mpfr_set_zero (MPC_IM (rop_sin), + ( ( mpfr_signbit (MPC_IM(op)) && !mpfr_signbit(c)) + || (!mpfr_signbit (MPC_IM(op)) && mpfr_signbit(c)) ? -1 : 1)); } if (rop_cos != NULL) { mpfr_set (MPC_RE (rop_cos), c, GMP_RNDN); /* exact */ inex_cos_re = inex_c; - mpfr_set_ui (MPC_IM (rop_cos), 0ul, GMP_RNDN); - if ( ( sign_im_op && mpfr_signbit (s)) - || (!sign_im_op && !mpfr_signbit (s))) - MPFR_CHANGE_SIGN (MPC_IM (rop_cos)); - /* FIXME: see previous MPFR_CHANGE_SIGN */ + mpfr_set_zero (MPC_IM (rop_cos), + ( ( mpfr_signbit (MPC_IM(op)) && mpfr_signbit(s)) + || (!mpfr_signbit (MPC_IM(op)) && !mpfr_signbit(s)) ? -1 : 1)); } mpfr_clear (s); |