summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2015-06-12 00:25:11 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2015-06-12 00:25:11 +0000
commit7edd881d9b9817b52f867c3afa72d95966192e41 (patch)
tree2de1420b27183553915c81302f01341c989935a9 /tests
parent926311881b0f1feeadaf5c3d615dda32f3c4ec85 (diff)
downloadmpfr-7edd881d9b9817b52f867c3afa72d95966192e41.tar.gz
[tests/tfma.c] Corrected the new underflow tests to really generate
underflows, showing a bug in mpfr_fma. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9566 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tfma.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/tfma.c b/tests/tfma.c
index 2f064735e..342b8c86e 100644
--- a/tests/tfma.c
+++ b/tests/tfma.c
@@ -345,22 +345,22 @@ test_underflow3 (int n)
mpfr_inits2 (8, x, y, z, t1, t2, (mpfr_ptr) 0);
- e = mpfr_get_emin ();
+ e = mpfr_get_emin () - 1;
- for (k = 1; k <= 4; k++)
+ for (k = 1; k <= 7; k++)
{
mpfr_set_si_2exp (x, 1, e, MPFR_RNDN);
- mpfr_set_si_2exp (y, (1 << k) + 1, - k, MPFR_RNDN);
+ mpfr_set_si_2exp (y, k, -3, MPFR_RNDN);
mpfr_neg (z, x, MPFR_RNDN);
- /* x = 2^emin
- y = 1 + 2^(-k)
- z = -2^emin
- FMA(x,y,z) = 2^(emin-k) exactly */
+ /* x = 2^(emin-1)
+ y = k/8
+ z = -2^(emin-1)
+ FMA(x,y,z) = (k-8) * 2^(emin-4) exactly */
RND_LOOP (rnd)
{
mpfr_clear_flags ();
- inex1 = mpfr_set_si_2exp (t1, 1, e - k, (mpfr_rnd_t) rnd);
+ inex1 = mpfr_set_si_2exp (t1, k - 8, e - 3, (mpfr_rnd_t) rnd);
flags1 = __gmpfr_flags;
mpfr_clear_flags ();