summaryrefslogtreecommitdiff
path: root/tests/tpow.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tpow.c')
-rw-r--r--tests/tpow.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/tpow.c b/tests/tpow.c
index 368c29199..fa183e77e 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -268,7 +268,7 @@ particular_cases (void)
}
static void
-underflows(void)
+underflows (void)
{
mpfr_t x, y;
int i;
@@ -299,6 +299,30 @@ underflows(void)
mpfr_clear (y);
}
+static void
+overflows (void)
+{
+ mpfr_t a, b;
+
+ /* bug found by Ming J. Tsai <mingjt@delvron.us>, 4 Oct 2003 */
+
+ mpfr_init_set_d (a, 5.1e32, GMP_RNDN);
+ mpfr_init (b);
+
+ mpfr_pow (b, a, a, GMP_RNDN);
+ if (!(mpfr_inf_p (b) && mpfr_sgn (b) > 0))
+ {
+ printf ("Error for a^a for a=5.1e32\n");
+ printf ("Expected +Inf, got ");
+ mpfr_out_str (stdout, 10, 0, b, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear(a);
+ mpfr_clear(b);
+}
+
int
main (void)
{
@@ -317,6 +341,8 @@ main (void)
/* underflows (); */
+ overflows ();
+
tests_end_mpfr ();
return 0;
}