diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-08-26 20:13:50 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-08-26 20:13:50 +0000 |
commit | 348002c98038cbcc990cd1f76864ea82759fe5f9 (patch) | |
tree | d8fdee1f1825cb351301aa4219a35499f38d8f7c /cot.c | |
parent | 002839fa59ec9b4dd0336d28aa15bc790a4a1926 (diff) | |
download | mpfr-348002c98038cbcc990cd1f76864ea82759fe5f9.tar.gz |
[csch.c,coth.c,csc.c,cot.c] fixed bug for tiny input and RNDA (result was
rounded to zero instead of away)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6394 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'cot.c')
-rw-r--r-- | cot.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -60,20 +60,22 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., { \ /* Case |x| = 2^emin. 1/x is not representable; so, compute \ 1/(2x) instead (exact), and correct the result later. */ \ - mpfr_set_si_2exp (y, signx, __gmpfr_emax, MPFR_RNDN); \ + mpfr_set_si_2exp (y, signx, __gmpfr_emax, MPFR_RNDN); \ inexact = 0; \ } \ else \ inexact = mpfr_ui_div (y, 1, x, r); \ if (inexact == 0) /* x is a power of two */ \ { /* result always 1/x, except when rounding to zero */ \ + if (rnd_mode == MPFR_RNDA) \ + rnd_mode = (signx > 0) ? MPFR_RNDU : MPFR_RNDD; \ if (rnd_mode == MPFR_RNDU || (rnd_mode == MPFR_RNDZ && signx < 0)) \ { \ if (signx < 0) \ mpfr_nextabove (y); /* -2^k + epsilon */ \ inexact = 1; \ } \ - else if (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ) \ + else if (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ) \ { \ if (signx > 0) \ mpfr_nextbelow (y); /* 2^k - epsilon */ \ |