diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-08-08 13:01:31 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-08-08 13:01:31 +0000 |
commit | e6db0fe6bd359c65b8fdd87b6c6af610e802ce4b (patch) | |
tree | 446f19646d4be3f9fa1b194c8f896dcd04956d1d | |
parent | 50315d13d79d6a7fe8e60b2865bc89eae81f7c08 (diff) | |
download | mpfr-e6db0fe6bd359c65b8fdd87b6c6af610e802ce4b.tar.gz |
fixed bug in mpfr_sin (possible wrong inexact flag for rounding to nearest)
added items in NEWS and TODO
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3705 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | sin.c | 5 | ||||
-rw-r--r-- | tests/tsin.c | 5 |
4 files changed, 11 insertions, 3 deletions
@@ -38,6 +38,7 @@ Changes from version 2.1.1 to version 2.2.0: features. - Thread safe (if built with --enable-thread-safe). - Logging facility. +- Change in the semantics of mpfr_out_str/mpfr_get_str when n_digits=0. Changes from version 2.1.0 to version 2.1.1: - Better way to detect the GMP library. @@ -203,6 +203,9 @@ New functions to implement: - radians - sqrtpi +- mpfr_frexp(mpfr_t rop, mp_exp_t *n, mpfr_t op, mp_rnd_t rnd) suggested by + Steve Kargl <sgk@troutmask.apl.washington.edu> Sun, 7 Aug 2005 + ############################################################################## Efficiency: ############################################################################## @@ -162,7 +162,10 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode) { /* the absolute error on c is at most 2^(3-m-EXP(c)) */ e = 2 * MPFR_GET_EXP (c) + m - 3; - if (mpfr_can_round (c, e, GMP_RNDZ, rnd_mode, precy)) + if (mpfr_can_round (c, e, GMP_RNDZ, GMP_RNDZ, + precy + (rnd_mode == GMP_RNDN))) + /* WARNING: need one more bit for rounding to nearest, + to be able to get the inexact flag correct */ break; /* check for huge cancellation (Near 0) */ diff --git a/tests/tsin.c b/tests/tsin.c index 5d8bfe65d..6919bc9f4 100644 --- a/tests/tsin.c +++ b/tests/tsin.c @@ -21,6 +21,7 @@ MA 02110-1301, USA. */ #include <stdio.h> #include <stdlib.h> +#include <string.h> /* for strlen */ #include "mpfr-test.h" @@ -185,7 +186,7 @@ check_regression () mp_prec_t p; int i; - p = strlen (xs) -2 - 3; + p = strlen (xs) - 2 - 3; mpfr_inits2 (p, x, y, NULL); mpfr_set_str (x, xs, 2, GMP_RNDN); @@ -208,6 +209,7 @@ main (int argc, char *argv[]) tests_start_mpfr (); + check_regression (); check_nans (); /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */ @@ -280,7 +282,6 @@ main (int argc, char *argv[]) test_generic (2, 100, 20); test_sign (); - check_regression (); tests_end_mpfr (); return 0; |