diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-03-30 00:00:47 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-03-30 00:00:47 +0000 |
commit | 100d483e5d63a1d79d9e8c277be70e90bcfb5dbb (patch) | |
tree | bbdebea67f01a0345ec0b5abec49b0c52e899ee9 /tests/tfmma.c | |
parent | ff1e2ee315ffab91a62a3c7b04098e17035215ab (diff) | |
download | mpfr-100d483e5d63a1d79d9e8c277be70e90bcfb5dbb.tar.gz |
UBF support fixed in mpfr_sub1 (src/sub1.c):
* underflow detection (which could affect mpfr_{fma,fms,fmma,fmms});
* MPFR_RNDF (mpfr_set4, which doesn't support UBF, could be called).
In the tests directory:
* tfma.c: disabled some tests on MPFR_RNDF (since the results are
not fully specified, the tests are heuristics only and depend on
a particular implementation, which has changed for the bug fix).
* tfmma.c: added a testcase showing how the above bug could affect
mpfr_fmms.
* tsub.c: added tests on UBF (thus using internals).
(merged changesets r13703,13796-13807,13810-13815,13818,13821 from the
trunk)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13837 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfmma.c')
-rw-r--r-- | tests/tfmma.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tfmma.c b/tests/tfmma.c index a4243cca2..34567bd5a 100644 --- a/tests/tfmma.c +++ b/tests/tfmma.c @@ -577,6 +577,26 @@ bug20200206 (void) mpfr_set_emin (emin); } +/* check for integer overflow (see bug fixed in r13798) */ +static void +extreme_underflow (void) +{ + mpfr_t x, y, z; + mpfr_exp_t emin = mpfr_get_emin (); + + set_emin (MPFR_EMIN_MIN); + mpfr_inits2 (64, x, y, z, (mpfr_ptr) 0); + mpfr_set_ui_2exp (x, 1, MPFR_EMIN_MIN - 1, MPFR_RNDN); + mpfr_set (y, x, MPFR_RNDN); + mpfr_nextabove (x); + mpfr_clear_flags (); + mpfr_fmms (z, x, x, y, y, MPFR_RNDN); + MPFR_ASSERTN (__gmpfr_flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT)); + MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z)); + mpfr_clears (x, y, z, (mpfr_ptr) 0); + set_emin (emin); +} + /* Test double-rounding cases in mpfr_set_1_2, which is called when all the precisions are the same. With set.c before r13347, this triggers errors for neg=0. */ @@ -655,6 +675,7 @@ main (int argc, char *argv[]) half_plus_half (); bug20170405 (); double_rounding (); + extreme_underflow (); tests_end_mpfr (); return 0; |