diff options
Diffstat (limited to 'tests/tgmpop.c')
-rw-r--r-- | tests/tgmpop.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/tgmpop.c b/tests/tgmpop.c index ce0f9d440..06d0e844e 100644 --- a/tests/tgmpop.c +++ b/tests/tgmpop.c @@ -107,6 +107,28 @@ special (void) CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); res = mpfr_div_q (y, x, z, MPFR_RNDN); CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_SIGN (y) < 0 && res == 0); + mpq_set_ui (z, 1, 0); + mpfr_set_inf (x, 1); + res = mpfr_add_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("+Inf + +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("+Inf - +Inf", MPFR_IS_NAN (y) && res == 0); + mpfr_set_inf (x, -1); + res = mpfr_add_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("-Inf + +Inf", MPFR_IS_NAN (y) && res == 0); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("-Inf - +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + mpq_set_si (z, -1, 0); + mpfr_set_inf (x, 1); + res = mpfr_add_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("+Inf + -Inf", MPFR_IS_NAN (y) && res == 0); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("+Inf - -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0); + mpfr_set_inf (x, -1); + res = mpfr_add_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("-Inf + -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0); + res = mpfr_sub_q (y, x, z, MPFR_RNDN); + CHECK_FOR ("-Inf - -Inf", MPFR_IS_NAN (y) && res == 0); /* 0 */ mpq_set_ui (z, 0, 1); |