summaryrefslogtreecommitdiff
path: root/tests/tmul_2exp.c
diff options
context:
space:
mode:
authorhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>2000-06-15 10:15:58 +0000
committerhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>2000-06-15 10:15:58 +0000
commitec43854ba592445999b0666580e114045345334c (patch)
treed5eb8760883ed97267dfa82252a03c0d335998d5 /tests/tmul_2exp.c
parentf9b7c78b3d40f23d8b4291e2ae66f101056c3d51 (diff)
downloadmpfr-ec43854ba592445999b0666580e114045345334c.tar.gz
Added div_2exp to the (very rough) test.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@609 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul_2exp.c')
-rw-r--r--tests/tmul_2exp.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
index fc04a0b2a..96da66435 100644
--- a/tests/tmul_2exp.c
+++ b/tests/tmul_2exp.c
@@ -31,19 +31,30 @@ MA 02111-1307, USA. */
int
main(argc,argv) int argc; char *argv[];
{
- double x, z; mpfr_t w;
+ double x, z; mpfr_t w; unsigned long k;
mpfr_init2(w, 53);
- srand48(time(NULL));
- x = drand48();
- mpfr_set_d(w, x, 0);
- mpfr_mul_2exp(w, w, 10, GMP_RNDZ);
- if (x != (z = mpfr_get_d(w)/1024))
- {
- fprintf(stderr, "%f != %f\n", x, z);
- return (-1);
- }
+ for (k = 0; k < 100000; k++) {
+ srand48(time(NULL));
+ x = drand48();
+ mpfr_set_d(w, x, 0);
+ mpfr_mul_2exp(w, w, 10, GMP_RNDZ);
+ if (x != (z = mpfr_get_d(w)/1024))
+ {
+ fprintf(stderr, "%f != %f\n", x, z);
+ return (-1);
+ }
+
+ mpfr_set_d(w, x, 0);
+ mpfr_div_2exp(w, w, 10, GMP_RNDZ);
+ if (x != (z = mpfr_get_d(w)*1024))
+ {
+ fprintf(stderr, "%f != %f\n", x, z);
+ return (-1);
+ }
+ }
+
return (0);
}