summaryrefslogtreecommitdiff
path: root/tests/tfactorial.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2005-08-18 16:35:19 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2005-08-18 16:35:19 +0000
commitbab5aab404897a12fe1c87734ebf2aa270b9b73b (patch)
tree73ab96f558e7e0b4ef371902ead983189184a0f7 /tests/tfactorial.c
parent8328a51518450ad8ddb86e38e7952e28065ff22a (diff)
downloadmpfr-bab5aab404897a12fe1c87734ebf2aa270b9b73b.tar.gz
Converted tabs to spaces with expand.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3725 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfactorial.c')
-rw-r--r--tests/tfactorial.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/tests/tfactorial.c b/tests/tfactorial.c
index 7379827b7..4f9cff08d 100644
--- a/tests/tfactorial.c
+++ b/tests/tfactorial.c
@@ -152,55 +152,55 @@ main (int argc, char *argv[])
mpfr_set_prec (y, yprec);
for (n = 0; n < 50; n++)
- for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
- {
- inexact = mpfr_fac_ui (y, n, (mp_rnd_t) rnd);
- err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
- if (mpfr_can_round (y, err, (mp_rnd_t) rnd, (mp_rnd_t) rnd, prec))
- {
- mpfr_set (t, y, (mp_rnd_t) rnd);
- inexact = mpfr_fac_ui (z, n, (mp_rnd_t) rnd);
- /* fact(n) ends with floor(n/2)+floor(n/4)+... zeros */
- for (k=n/2, zeros=0; k; k >>= 1)
- zeros += k;
- if (MPFR_EXP(y) <= (mp_exp_t) (prec + zeros))
- /* result should be exact */
- {
- if (inexact)
- {
- printf ("Wrong inexact flag: expected exact\n");
- exit (1);
- }
- }
- else /* result is inexact */
- {
- if (!inexact)
- {
- printf ("Wrong inexact flag: expected inexact\n");
- printf ("n=%u prec=%u\n", n, prec);
- mpfr_print_binary(z); puts ("");
- exit (1);
- }
- }
- if (mpfr_cmp (t, z))
- {
- printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
- printf (" prec=%u rnd_mode=%s\n", prec,
- mpfr_print_rnd_mode ((mp_rnd_t) rnd));
- printf (" got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- puts ("");
- printf (" expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- puts ("");
- printf (" approximation was ");
- mpfr_print_binary (y);
- puts ("");
- exit (1);
- }
- }
- }
+ for (rnd = 0; rnd < GMP_RND_MAX; rnd++)
+ {
+ inexact = mpfr_fac_ui (y, n, (mp_rnd_t) rnd);
+ err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
+ if (mpfr_can_round (y, err, (mp_rnd_t) rnd, (mp_rnd_t) rnd, prec))
+ {
+ mpfr_set (t, y, (mp_rnd_t) rnd);
+ inexact = mpfr_fac_ui (z, n, (mp_rnd_t) rnd);
+ /* fact(n) ends with floor(n/2)+floor(n/4)+... zeros */
+ for (k=n/2, zeros=0; k; k >>= 1)
+ zeros += k;
+ if (MPFR_EXP(y) <= (mp_exp_t) (prec + zeros))
+ /* result should be exact */
+ {
+ if (inexact)
+ {
+ printf ("Wrong inexact flag: expected exact\n");
+ exit (1);
+ }
+ }
+ else /* result is inexact */
+ {
+ if (!inexact)
+ {
+ printf ("Wrong inexact flag: expected inexact\n");
+ printf ("n=%u prec=%u\n", n, prec);
+ mpfr_print_binary(z); puts ("");
+ exit (1);
+ }
+ }
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
+ printf (" prec=%u rnd_mode=%s\n", prec,
+ mpfr_print_rnd_mode ((mp_rnd_t) rnd));
+ printf (" got ");
+ mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
+ puts ("");
+ printf (" expected ");
+ mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
+ puts ("");
+ printf (" approximation was ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ }
+ }
}
mpfr_clear (x);