diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2012-07-06 07:26:34 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2012-07-06 07:26:34 +0000 |
commit | c1ab0fa6c44908699f92cdbef7fd00c875cd3407 (patch) | |
tree | f6b9f6e08709bda035f6a7d3c408cdcad152531b /src | |
parent | c32a5068a9f7adbd842789af3e14df3fff12e732 (diff) | |
download | mpc-c1ab0fa6c44908699f92cdbef7fd00c875cd3407.tar.gz |
atan.c: transform test into assertion, add comments
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1236 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src')
-rw-r--r-- | src/atan.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -332,6 +332,8 @@ mpc_atan (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) mpfr_sub (y, a, b, GMP_RNDU); if (mpfr_zero_p (y)) + /* FIXME: happens when x and y have very different magnitudes; + could be handled more efficiently */ ok = 0; else { @@ -345,8 +347,12 @@ mpc_atan (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) err = (expo < 0) ? 1 : expo + 2; mpfr_div_2ui (y, y, 2, GMP_RNDN); - if (mpfr_zero_p (y)) - err = 2; /* underflow */ + MPC_ASSERT (!mpfr_zero_p (y)); + /* FIXME: underflow. Since the main term of the Taylor series + in y=0 is 1/(x^2+1) * y, this means that y is very small + and/or x very large; but then the mpfr_zero_p (y) above + should be true. This needs a proof, or better yet, + special code. */ ok = mpfr_can_round (y, p - err, GMP_RNDU, GMP_RNDD, prec + (MPC_RND_IM (rnd) == GMP_RNDN)); |