summaryrefslogtreecommitdiff
path: root/tests/tmul_2exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tmul_2exp.c')
-rw-r--r--tests/tmul_2exp.c63
1 files changed, 36 insertions, 27 deletions
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
index b2a2b071f..751978ae4 100644
--- a/tests/tmul_2exp.c
+++ b/tests/tmul_2exp.c
@@ -34,39 +34,48 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- double x, z; mpfr_t w; unsigned long k;
+ double x, z; mpfr_t w; unsigned long k;
tests_start_mpfr ();
- mpfr_init2(w, 53);
+ mpfr_init2(w, 53);
mpfr_set_inf (w, 1);
- mpfr_mul_2exp (w, w, 10, GMP_RNDZ);
- if (!MPFR_IS_INF(w)) { fprintf(stderr, "Inf != Inf"); exit(-1); }
-
+ mpfr_mul_2exp (w, w, 10, GMP_RNDZ);
+ if (!MPFR_IS_INF(w))
+ {
+ printf ("Inf != Inf");
+ exit (1);
+ }
+
mpfr_set_nan (w);
- mpfr_mul_2exp (w, w, 10, GMP_RNDZ);
- if (!MPFR_IS_NAN(w)) { fprintf(stderr, "NaN != NaN"); exit(-1); }
-
- for (k = 0; k < 100000; k++) {
- x = DBL_RAND ();
- mpfr_set_d (w, x, 0);
- mpfr_mul_2exp (w, w, 10, GMP_RNDZ);
- if (x != (z = mpfr_get_d1 (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_d1 (w)*1024))
- {
- fprintf(stderr, "%f != %f\n", x, z);
- mpfr_clear(w);
- return -1;
- }
- }
+ mpfr_mul_2exp (w, w, 10, GMP_RNDZ);
+ if (!MPFR_IS_NAN(w))
+ {
+ printf ("NaN != NaN");
+ exit (1);
+ }
+
+ for (k = 0; k < 100000; k++)
+ {
+ x = DBL_RAND ();
+ mpfr_set_d (w, x, 0);
+ mpfr_mul_2exp (w, w, 10, GMP_RNDZ);
+ if (x != (z = mpfr_get_d1 (w)/1024))
+ {
+ printf ("%f != %f\n", x, z);
+ exit (1);
+ }
+
+ mpfr_set_d(w, x, 0);
+ mpfr_div_2exp(w, w, 10, GMP_RNDZ);
+ if (x != (z = mpfr_get_d1 (w)*1024))
+ {
+ printf ("%f != %f\n", x, z);
+ mpfr_clear (w);
+ exit (1);
+ }
+ }
mpfr_clear(w);