summaryrefslogtreecommitdiff
path: root/tests/tmul_ui.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>1999-07-01 12:47:55 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>1999-07-01 12:47:55 +0000
commit63035c0590408e63adb0c803b9df219b37087530 (patch)
tree8481534a2c4ff9dde7c12bcb84012dbf378fdfe3 /tests/tmul_ui.c
parent6f6a8cc23d436e5c02e70f740f589ce7b247f702 (diff)
downloadmpfr-63035c0590408e63adb0c803b9df219b37087530.tar.gz
added one test to check that 1*y = y
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@237 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul_ui.c')
-rw-r--r--tests/tmul_ui.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
index bffd4dec1..de039632d 100644
--- a/tests/tmul_ui.c
+++ b/tests/tmul_ui.c
@@ -8,17 +8,23 @@
int
main(int argc, char **argv)
{
- mpfr_t x;
+ mpfr_t x, y;
- mpfr_init2(x, 53);
+ mpfr_init2(x, 53); mpfr_init2(y, 53);
/* checks that result is normalized */
- mpfr_set_d(x, 6.93147180559945286227e-01, GMP_RNDZ);
- mpfr_mul_ui(x, x, 1, GMP_RNDZ);
+ mpfr_set_d(y, 6.93147180559945286227e-01, GMP_RNDZ);
+ mpfr_mul_ui(x, y, 1, GMP_RNDZ);
if (MANT(x)[PREC(x)/BITS_PER_MP_LIMB] >> (BITS_PER_MP_LIMB-1) == 0) {
fprintf(stderr, "Error in mpfr_mul_ui: result not normalized\n");
exit(1);
}
+ if (mpfr_cmp(x,y)) {
+ fprintf(stderr, "Error in mpfr_mul_ui: 1*y != y\n");
+ printf("y= "); mpfr_print_raw(y); putchar('\n');
+ printf("1*y="); mpfr_print_raw(x); putchar('\n');
+ exit(1);
+ }
mpfr_set_d(x, 1.0/3.0, GMP_RNDZ);
mpfr_mul_ui(x, x, 3, GMP_RNDU);
@@ -26,6 +32,6 @@ main(int argc, char **argv)
fprintf(stderr, "U(Z(1/3)*3) does not give 1\n"); exit(1);
}
- mpfr_clear(x);
+ mpfr_clear(x); mpfr_clear(y);
return(0);
}