diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-11-02 17:22:13 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-11-02 17:22:13 +0000 |
commit | 965d51f78cc3fdf9c5f8d6f8286a9b7e53bd2deb (patch) | |
tree | 89d3582f9c65a65616638ab5672256e722b8f6d1 /tests | |
parent | 041b6b2d9b0f969e1af7abf853f1acdd458b45fc (diff) | |
download | mpfr-965d51f78cc3fdf9c5f8d6f8286a9b7e53bd2deb.tar.gz |
Merged the changes from branch vlefevre:
* mpfr-impl.h: Added MPFR_RNDRAW_GEN based on MPFR_RNDRAW and
MPFR_RNDRAW_EVEN codes, but taking an additional argument: a
handler executed in rounding to nearest mode when the value
is the middle of two consecutive numbers in dest precision.
MPFR_RNDRAW and MPFR_RNDRAW_EVEN are now defined by a "call"
to MPFR_RNDRAW_GEN.
* cache.c: Clean-up and use MPFR_RNDRAW_GEN instead of
MPFR_RNDRAW_EVEN to avoid an unnecessary correction in the
halfway case.
* hypot.c: Fixed mpfr_hypot when the rounding mode is to nearest,
x is "much larger" than y, and x is the middle of two consecutive
numbers in the target precision.
* tests/thypot.c: Added the corresponding testcase.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3929 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/thypot.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/thypot.c b/tests/thypot.c index 7d41d2710..52577e640 100644 --- a/tests/thypot.c +++ b/tests/thypot.c @@ -131,7 +131,26 @@ test_large_small (void) inexact = mpfr_hypot (z, x, y, GMP_RNDN); if (inexact >= 0 || mpfr_cmp (x, z)) { - printf ("Error in test_large_small\n"); + printf ("Error 1 in test_large_small\n"); + exit (1); + } + + mpfr_mul_ui (x, x, 5, GMP_RNDN); + inexact = mpfr_hypot (z, x, y, GMP_RNDN); + if (mpfr_cmp (x, z) >= 0) + { + printf ("Error 2 in test_large_small\n"); + printf ("x = "); + mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); + printf ("\n"); + printf ("y = "); + mpfr_out_str (stdout, 2, 0, y, GMP_RNDN); + printf ("\n"); + printf ("z = "); + mpfr_out_str (stdout, 2, 0, z, GMP_RNDN); + printf (" (in precision 2) instead of\n "); + mpfr_out_str (stdout, 2, 2, x, GMP_RNDU); + printf ("\n"); exit (1); } |