diff options
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | src/proj.c | 25 |
2 files changed, 13 insertions, 20 deletions
@@ -1,7 +1,9 @@ Recent changes: - - Bug fix: - mpc_mul returns correct results even if there are over- or underflows - during the computation + - Bug fixes: + - mul now returns correct results even if there are over- or underflows + during the computation + - proj: wrong result when input variable has infinite part and equals + output variable Changes in version 0.9: - New functions: @@ -1,6 +1,6 @@ /* mpc_proj -- projection of a complex number onto the Riemann sphere. -Copyright (C) INRIA, 2008, 2009 +Copyright (C) INRIA, 2008, 2009, 2011 This file is part of the MPC Library. @@ -24,21 +24,12 @@ MA 02111-1307, USA. */ int mpc_proj (mpc_ptr a, mpc_srcptr b, mpc_rnd_t rnd) { - if (mpc_inf_p (b)) - { - /* infinities projects to +Inf +i* copysign(0.0, cimag(z)) */ - int inex; - + if (mpc_inf_p (b)) { + /* infinities project to +Inf +i* copysign(0.0, cimag(z)) */ mpfr_set_inf (MPC_RE (a), +1); - inex = mpfr_set_ui (MPC_IM (a), 0, MPC_RND_IM (rnd)); - if (mpfr_signbit (MPC_IM (b))) - { - mpc_conj (a, a, MPC_RNDNN); - inex = -inex; - } - - return MPC_INEX (0, inex); - } - else - return mpc_set (a, b, rnd); + mpfr_set_zero (MPC_IM (a), (mpfr_signbit (MPC_IM (b)) ? -1 : 1)); + return MPC_INEX (0, 0); + } + else + return mpc_set (a, b, rnd); } |