From 11e7dbb0f0a3dc37db1fce79c5c23ae63053dc8c Mon Sep 17 00:00:00 2001 From: Paul Zimmermann Date: Thu, 6 Feb 2020 09:54:50 +0100 Subject: added test for bug in mpfr_fmms (fixed in MPFR revision 13688) --- tests/tmul.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/tmul.c b/tests/tmul.c index 4331ba9..ee9a0f7 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -130,6 +130,34 @@ check_regular (void) mpc_clear (y); } +static void +bug20200206 (void) +{ + mpfr_exp_t emin = mpfr_get_emin (); + mpc_t x, y, z; + + mpfr_set_emin (-1073); + mpc_init2 (x, 53); + mpc_init2 (y, 53); + mpc_init2 (z, 53); + mpfr_set_d (mpc_realref (x), -6.0344722345057644e-272, MPFR_RNDN); + mpfr_set_d (mpc_imagref (x), -4.8536770224196353e-204, MPFR_RNDN); + mpfr_set_d (mpc_realref (y), 1.3834775731431992e-246, MPFR_RNDN); + mpfr_set_d (mpc_imagref (y), 2.9246270396940562e-124, MPFR_RNDN); + mpc_mul (z, x, y, MPC_RNDNN); + if (mpfr_regular_p (mpc_realref (z)) && + mpfr_get_exp (mpc_realref (z)) < -1073) + { + printf ("Error, mpc_mul returns an out-of-range exponent:\n"); + mpfr_dump (mpc_realref (z)); + printf ("Bug most probably in MPFR, please upgrade to MPFR 4.0.3 or later\n"); + exit (1); + } + mpc_clear (x); + mpc_clear (y); + mpc_clear (z); + mpfr_set_emin (emin); +} #ifdef TIMING static void @@ -199,6 +227,7 @@ main (void) timemul (); #endif + bug20200206 (); check_regular (); data_check_template ("mul.dsc", "mul.dat"); -- cgit v1.2.1