diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-06-20 14:53:41 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-06-20 14:53:41 +0000 |
commit | 4cd859de27089c5b4b34e1f3c07a1513ad9326ac (patch) | |
tree | cd5ae434b89b3f9a708edab873a0d107ae86b90a | |
parent | d9fc43579efc9a520ea634c9370283481b738989 (diff) | |
download | mpfr-4cd859de27089c5b4b34e1f3c07a1513ad9326ac.tar.gz |
[tests/tget_set_d128.c] improve test coverage
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12797 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tget_set_d128.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/tget_set_d128.c b/tests/tget_set_d128.c index a2070cee2..5d64866ee 100644 --- a/tests/tget_set_d128.c +++ b/tests/tget_set_d128.c @@ -358,6 +358,14 @@ check_misc (void) exit (1); } + /* exercise |x| > DEC128_MAX */ + mpfr_set_str (x, "10E6144", 10, MPFR_RNDU); + d = mpfr_get_decimal128 (x, MPFR_RNDZ); + MPFR_ASSERTN(d == DEC128_MAX); + mpfr_set_str (x, "-10E6144", 10, MPFR_RNDU); + d = mpfr_get_decimal128 (x, MPFR_RNDZ); + MPFR_ASSERTN(d == -DEC128_MAX); + mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); @@ -381,6 +389,22 @@ check_misc (void) if (! mpfr_equal_p (x, y)) PRINT_ERR_MISC ("1E1793"); + mpfr_set_str (x, "2E4095", 10, MPFR_RNDN); + d = mpfr_get_decimal128 (x, MPFR_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal128 (x, d, MPFR_RNDN); + mpfr_set_str (y, "2E4095", 10, MPFR_RNDN); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("2E4095"); + + mpfr_set_str (x, "2E-4096", 10, MPFR_RNDN); + d = mpfr_get_decimal128 (x, MPFR_RNDN); + mpfr_set_ui (x, 0, MPFR_RNDZ); + mpfr_set_decimal128 (x, d, MPFR_RNDN); + mpfr_set_str (y, "2E-4096", 10, MPFR_RNDN); + if (! mpfr_equal_p (x, y)) + PRINT_ERR_MISC ("2E-4096"); + mpfr_clear (x); mpfr_clear (y); } |