diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-12-07 10:29:57 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-12-07 10:29:57 +0000 |
commit | 5334ac010efe836dce241e7f71a69addbaabf3f1 (patch) | |
tree | 8d4201dfb8d1446c7594fac02c34b4acadaf25ae /tests | |
parent | e1ae09b3fc06ac8fb0533857121646d0cad37026 (diff) | |
download | mpfr-5334ac010efe836dce241e7f71a69addbaabf3f1.tar.gz |
tests/tsin_cos.c: in consistency(), added testing on underflow case.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6625 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tsin_cos.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c index 4e0f7f5db..9453c1087 100644 --- a/tests/tsin_cos.c +++ b/tests/tsin_cos.c @@ -560,21 +560,35 @@ static void consistency (void) { mpfr_t x, s1, s2, c1, c2; + mp_exp_t emin; mpfr_rnd_t rnd; unsigned int flags_sin, flags_cos, flags, flags_before; int inex_sin, is, inex_cos, ic, inex; int i; + emin = mpfr_get_emin (); + for (i = 0; i <= 10000; i++) { mpfr_init2 (x, MPFR_PREC_MIN + (randlimb () % 8)); mpfr_inits2 (MPFR_PREC_MIN + (randlimb () % 8), s1, s2, c1, c2, (mpfr_ptr) 0); - tests_default_random (x, 256, -5, 50); - rnd = RND_RAND (); - flags_before = (randlimb () & 1) ? - (unsigned int) (MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE) : - (unsigned int) 0; + if (i < 2 * MPFR_RND_MAX) + { + mpfr_set_emin (MPFR_EMIN_MIN); + mpfr_set_si (x, i < MPFR_RND_MAX ? 1 : -1, MPFR_RNDN); + mpfr_set_exp (x, mpfr_get_emin ()); + rnd = (mpfr_rnd_t) (i % MPFR_RND_MAX); + flags_before = 0; + } + else + { + tests_default_random (x, 256, -5, 50); + rnd = RND_RAND (); + flags_before = (randlimb () & 1) ? + (unsigned int) (MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE) : + (unsigned int) 0; + } __gmpfr_flags = flags_before; inex_sin = mpfr_sin (s1, x, rnd); is = inex_sin < 0 ? 2 : inex_sin > 0 ? 1 : 0; @@ -607,6 +621,7 @@ consistency (void) exit (1); } mpfr_clears (x, s1, s2, c1, c2, (mpfr_ptr) 0); + mpfr_set_emin (emin); } } |