diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 1999-06-09 18:03:33 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 1999-06-09 18:03:33 +0000 |
commit | 0cf5fc5ea4b5ed46b454d3bf3adc620d9fff2d32 (patch) | |
tree | 62d12a119f5dfc15abe2f6d298617e174a0a06af /tests/tmul_2exp.c | |
parent | 8d21dd7188076894a6f65e510797c8c6928e474f (diff) | |
download | mpfr-0cf5fc5ea4b5ed46b454d3bf3adc620d9fff2d32.tar.gz |
Initial revision
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul_2exp.c')
-rw-r--r-- | tests/tmul_2exp.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c new file mode 100644 index 000000000..3f6055727 --- /dev/null +++ b/tests/tmul_2exp.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include "gmp.h" +#include "mpfr.h" + +/* checks that x*y gives the same results in double + and with mpfr with 53 bits of precision */ + +void main(argc,argv) int argc; char *argv[]; +{ + double x, z; mpfr_t w; + + mpfr_init2(w, 53); + + srand48(time(NULL)); + x = drand48(); + mpfr_set_d(w, x, 53, 1, 0); + mpfr_mul_2exp(w, w, 10, GMP_RNDZ); + if (x != (z = mpfr_get_d(w)/1024)) + { + fprintf(stderr, "%lf != %lf\n", x, z); + }; +} + |