summaryrefslogtreecommitdiff
path: root/tests/tmul_2exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tmul_2exp.c')
-rw-r--r--tests/tmul_2exp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
index 511ef540d..645210f72 100644
--- a/tests/tmul_2exp.c
+++ b/tests/tmul_2exp.c
@@ -116,6 +116,19 @@ main (int argc, char *argv[])
}
}
+ if (MPFR_EXP_MAX >= LONG_MAX/2 && MPFR_EXP_MIN <= LONG_MAX/2-LONG_MAX-1)
+ {
+ mpfr_set_ui (w, 1, GMP_RNDN);
+ mpfr_mul_2ui (w, w, LONG_MAX/2, GMP_RNDZ);
+ mpfr_div_2ui (w, w, LONG_MAX+1, GMP_RNDZ);
+ mpfr_mul_2ui (w, w, LONG_MAX+1-LONG_MAX/2, GMP_RNDZ);
+ if (!mpfr_cmp_ui (w, 1))
+ {
+ printf ("Underflow LONG_MAX error!\n");
+ exit (1);
+ }
+ }
+
mpfr_clears (w, z, NULL);
tests_end_mpfr ();