summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-08-30 06:57:37 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-08-30 06:57:37 +0000
commit8f0dae45f1202976240f2a1eb8662df42b61b502 (patch)
tree65dafe07d116069be317869f4d3e78b9faf1d6ac
parent246eb01d6a22e4ddab008aacccf3e79c21fea123 (diff)
downloadmpfr-8f0dae45f1202976240f2a1eb8662df42b61b502.tar.gz
[tests/turandom.c] print got/expected probabilities in test_underflow()
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@11693 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/turandom.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/turandom.c b/tests/turandom.c
index 36b19b793..c62ffc68d 100644
--- a/tests/turandom.c
+++ b/tests/turandom.c
@@ -317,7 +317,8 @@ test_underflow (int verbose)
mpfr_init2 (x, 2);
mpfr_set_emin (-3);
- for (i = 0; i < 1000000; i++)
+#define N 1000000
+ for (i = 0; i < N; i++)
{
mpfr_urandom (x, RANDS, MPFR_RNDN);
if (mpfr_zero_p (x))
@@ -327,10 +328,17 @@ test_underflow (int verbose)
exp[1-mpfr_get_exp(x)] ++;
}
if (verbose)
- printf ("exp=1:%d 0:%d -1:%d -2:%d -3:%d x=0:%d\n",
- exp[0], exp[1], exp[2], exp[3], exp[4], exp[5]);
+ printf ("exp=1:%.3f(%.3f) 0:%.3f(%.3f) -1:%.3f(%.3f) -2:%.3f(%.3f) "
+ "-3:%.3f(%.3f) zero:%.3f(%.3f)\n",
+ 100.0 * (double) exp[0] / (double) N, 12.5,
+ 100.0 * (double) exp[1] / (double) N, 43.75,
+ 100.0 * (double) exp[2] / (double) N, 21.875,
+ 100.0 * (double) exp[3] / (double) N, 10.9375,
+ 100.0 * (double) exp[4] / (double) N, 7.8125,
+ 100.0 * (double) exp[5] / (double) N, 3.125);
mpfr_clear (x);
mpfr_set_emin (emin);
+#undef N
}
static void