diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-02-29 09:25:06 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-02-29 09:25:06 +0000 |
commit | 059e4e87d5342f3210bd5939a00770a5c15a905e (patch) | |
tree | 838b659ea3a02d705e7e2dc1759561ac3ca0ff38 /tools/mbench | |
parent | 8e7719f2d6a3c8a20bbeaa0d9229b72ca45bb253 (diff) | |
download | mpfr-059e4e87d5342f3210bd5939a00770a5c15a905e.tar.gz |
added value -2 for option -d to generate random number with exponent
exactly e. Example:
$ mfv5 -p113 -e16384 -d-2 -v mpfr_sin
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13734 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tools/mbench')
-rw-r--r-- | tools/mbench/mfv5.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/mbench/mfv5.cc b/tools/mbench/mfv5.cc index 6b59d015f..3a1b61b3c 100644 --- a/tools/mbench/mfv5.cc +++ b/tools/mbench/mfv5.cc @@ -83,6 +83,8 @@ build_base (vector<string> &base, const option_test &opt) mpfr_urandomb (x, state); if (opt.exp_diff == -1) mpfr_mul_2si (x, x, (rand() % opt.max_exp) - (opt.max_exp / 2), MPFR_RNDN); + else if (opt.exp_diff == -2) + mpfr_set_exp (x, opt.max_exp); else /* set the exponent to -i*exp_diff */ mpfr_set_exp (x, -(long) i * opt.exp_diff); str = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDN); @@ -161,7 +163,10 @@ int main (int argc, const char *argv[]) break; case 'd': options.exp_diff = atol (argv[i]+2); - assert (options.exp_diff >= 0); + assert (options.exp_diff >= -2); + /* exp_diff = -1 (default): exponent is chosen in [-e/2,e/2] + exp_dif >=0: the exponent of the ith value is -i*exp_diff + exp_dif = -2: the exponent is exactly e */ break; case 'r': { |