summaryrefslogtreecommitdiff
path: root/tests/tai.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-01-07 20:45:25 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-01-07 20:45:25 +0000
commit5c7d51ebe2399d47fa82ae6e06708cc811f8b8f5 (patch)
tree50363f55d80b2cffd2db63aec8d5f40cb7921c3e /tests/tai.c
parente14c3ae59b7d31d589d16936d217fa8997bb8e44 (diff)
downloadmpfr-5c7d51ebe2399d47fa82ae6e06708cc811f8b8f5.tar.gz
[tests/tai.c] In bug20180107, also check the flags.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12075 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tai.c')
-rw-r--r--tests/tai.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/tai.c b/tests/tai.c
index 71372cffa..c6b82b20c 100644
--- a/tests/tai.c
+++ b/tests/tai.c
@@ -96,6 +96,7 @@ bug20180107 (void)
mpfr_t x, y, z;
mpfr_exp_t emin;
int inex;
+ mpfr_flags_t flags;
mpfr_init2 (x, 152);
mpfr_init2 (y, 11);
@@ -103,23 +104,29 @@ bug20180107 (void)
mpfr_set_str_binary (x, "0.11010101100111000111001001010110101001100001011110101111000010100111011101011110000100111011101100100100001010000110100011001000111010010001110000011100E5");
emin = mpfr_get_emin ();
mpfr_set_emin (-134);
+ mpfr_clear_flags ();
inex = mpfr_ai (y, x, MPFR_RNDA);
+ flags = __gmpfr_flags;
/* result should be 0.10011100000E-135 with unlimited exponent range,
and thus should be rounded to 0.1E-134 */
mpfr_set_str_binary (z, "0.1E-134");
- MPFR_ASSERTN(mpfr_equal_p (y, z));
- MPFR_ASSERTN(inex > 0);
+ MPFR_ASSERTN (mpfr_equal_p (y, z));
+ MPFR_ASSERTN (inex > 0);
+ MPFR_ASSERTN (flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT));
mpfr_set_prec (x, 2);
mpfr_set_str_binary (x, "0.11E7");
mpfr_set_prec (y, 2);
+ mpfr_clear_flags ();
inex = mpfr_ai (y, x, MPFR_RNDA);
+ flags = __gmpfr_flags;
/* result should be 1.0E-908 with unlimited exponent range,
and thus should be rounded to 0.1E-134 */
mpfr_set_str_binary (z, "0.1E-134");
- MPFR_ASSERTN(mpfr_equal_p (y, z));
- MPFR_ASSERTN(inex > 0);
-
+ MPFR_ASSERTN (mpfr_equal_p (y, z));
+ MPFR_ASSERTN (inex > 0);
+ MPFR_ASSERTN (flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT));
+
mpfr_set_emin (emin);
mpfr_clear (x);
mpfr_clear (y);