summaryrefslogtreecommitdiff
path: root/tests/ttan.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-05 06:32:30 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-05 06:32:30 +0000
commit693f0688493e6b04c86309119743558f833be6e4 (patch)
treeeaf6bee4d00b592235a55bb9a651c9f9fffc2cf8 /tests/ttan.c
parentbb6b39b140c27f7e1bc3a35c98bcf744a8071bf5 (diff)
downloadmpfr-693f0688493e6b04c86309119743558f833be6e4.tar.gz
[tests/ttan.c] improve coverage (and also of round_near_x)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12547 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/ttan.c')
-rw-r--r--tests/ttan.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ttan.c b/tests/ttan.c
index 01eece979..22dfb7b8b 100644
--- a/tests/ttan.c
+++ b/tests/ttan.c
@@ -111,6 +111,27 @@ bug20171218 (void)
mpfr_clear (z);
}
+static void
+coverage (void)
+{
+ mpfr_t x, y;
+ int inex;
+ mpfr_exp_t emax;
+
+ /* exercise mpfr_round_near_x when rounding gives an overflow */
+ emax = mpfr_get_emax ();
+ mpfr_set_emax (-2);
+ mpfr_init2 (x, 2);
+ mpfr_init2 (y, 2);
+ mpfr_setmax (x, mpfr_get_emax ());
+ inex = mpfr_tan (y, x, MPFR_RNDA);
+ MPFR_ASSERTN(inex > 0);
+ MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_signbit (y) == 0);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_set_emax (emax);
+}
+
int
main (int argc, char *argv[])
{
@@ -121,6 +142,7 @@ main (int argc, char *argv[])
tests_start_mpfr ();
+ coverage ();
bug20171218 ();
check_nans ();