summaryrefslogtreecommitdiff
path: root/tests/tconst_pi.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2003-03-28 09:22:37 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2003-03-28 09:22:37 +0000
commite94c80c59c89c185962d674592300d59e723a4e9 (patch)
tree60d9b0da311fee2e2c23194ae6d4fa33ab1dfa96 /tests/tconst_pi.c
parentd342818eeb80c5461ba9f57fade851f669c7efc1 (diff)
downloadmpfr-e94c80c59c89c185962d674592300d59e723a4e9.tar.gz
fixed pb found by Will Galway <galway@pims.math.ca> (continued)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2282 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tconst_pi.c')
-rw-r--r--tests/tconst_pi.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c
index a04c20c96..245f1455e 100644
--- a/tests/tconst_pi.c
+++ b/tests/tconst_pi.c
@@ -30,7 +30,9 @@ MA 02111-1307, USA. */
int
main (int argc, char *argv[])
{
- mpfr_t x; int p; unsigned char rnd;
+ mpfr_t x;
+ int p;
+ unsigned char rnd;
tests_start_mpfr ();
@@ -42,17 +44,25 @@ main (int argc, char *argv[])
p = a;
}
- rnd = (argc>2) ? atoi(argv[2]) : GMP_RNDZ;
-
- mpfr_init2(x, p);
- mpfr_const_pi(x, rnd);
- if (argc >= 2 && atoi(argv[2])) {
- printf("Pi="); mpfr_out_str(stdout, 10, 0, x, rnd); putchar('\n');
- }
- else if (mpfr_get_d1 (x) != 3.141592653589793116) {
- fprintf(stderr, "mpfr_const_pi failed for prec=53\n"); exit(1);
- }
- mpfr_clear(x);
+ rnd = (argc > 2) ? atoi(argv[2]) : GMP_RNDZ;
+
+ mpfr_init2 (x, p);
+ mpfr_const_pi (x, rnd);
+ if (argc >= 2)
+ {
+ if (argc < 4 || atoi (argv[3]) != 0)
+ {
+ printf ("Pi=");
+ mpfr_out_str (stdout, 10, 0, x, rnd);
+ putchar ('\n');
+ }
+ }
+ else if (mpfr_get_d1 (x) != 3.141592653589793116)
+ {
+ fprintf (stderr, "mpfr_const_pi failed for prec=53\n");
+ exit (1);
+ }
+ mpfr_clear (x);
tests_end_mpfr ();
return 0;