diff options
-rw-r--r-- | mpfr-test.h | 14 | ||||
-rw-r--r-- | mpfr.h | 4 | ||||
-rw-r--r-- | shortmul.c | 3 | ||||
-rw-r--r-- | tests/reuse.c | 44 | ||||
-rw-r--r-- | tests/tabs.c | 2 | ||||
-rw-r--r-- | tests/tadd.c | 41 | ||||
-rw-r--r-- | tests/tadd_ui.c | 8 | ||||
-rw-r--r-- | tests/tagm.c | 18 | ||||
-rw-r--r-- | tests/tatan.c | 4 | ||||
-rw-r--r-- | tests/tcmp2.c | 15 | ||||
-rw-r--r-- | tests/tcos.c | 5 | ||||
-rw-r--r-- | tests/tdiv.c | 19 | ||||
-rw-r--r-- | tests/tdiv_ui.c | 7 | ||||
-rw-r--r-- | tests/teq.c | 7 | ||||
-rw-r--r-- | tests/texp.c | 17 | ||||
-rw-r--r-- | tests/tget_str.c | 11 | ||||
-rw-r--r-- | tests/thyperbolic.c | 22 | ||||
-rw-r--r-- | tests/tlog.c | 23 | ||||
-rw-r--r-- | tests/tmul.c | 27 | ||||
-rw-r--r-- | tests/tout_str.c | 8 | ||||
-rw-r--r-- | tests/tpow.c | 15 | ||||
-rw-r--r-- | tests/trandom.c | 17 | ||||
-rw-r--r-- | tests/tset.c | 2 | ||||
-rw-r--r-- | tests/tset_z.c | 9 | ||||
-rw-r--r-- | tests/tsin.c | 5 | ||||
-rw-r--r-- | tests/tsqrt.c | 14 | ||||
-rw-r--r-- | tests/tsqrt_ui.c | 5 | ||||
-rw-r--r-- | tests/tsub.c | 8 | ||||
-rw-r--r-- | tests/tsub_ui.c | 8 | ||||
-rw-r--r-- | tests/ttan.c | 5 | ||||
-rw-r--r-- | tests/tui_div.c | 7 | ||||
-rw-r--r-- | tests/tui_sub.c | 2 | ||||
-rw-r--r-- | tests/tzeta.c | 3 |
33 files changed, 246 insertions, 153 deletions
diff --git a/mpfr-test.h b/mpfr-test.h index bc49a7af5..fe7813e17 100644 --- a/mpfr-test.h +++ b/mpfr-test.h @@ -1,6 +1,6 @@ /* auxiliary functions for MPFR tests. -Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -43,7 +43,8 @@ double Ulp _PROTO ((double)); /* generate a random double using the whole range of possible values, including denormalized numbers, NaN, infinities, ... */ -double drand () +double +drand (void) { double d; int *i, expo; @@ -59,7 +60,8 @@ double drand () } /* returns ulp(x) for x a 'normal' double-precision number */ -double Ulp (double x) +double +Ulp (double x) { double y, eps; @@ -78,7 +80,8 @@ double Ulp (double x) } /* returns the number of ulp's between a and b */ -int ulp (double a, double b) +int +ulp (double a, double b) { if (a==0.0) { if (b==0.0) return 0; @@ -89,7 +92,8 @@ int ulp (double a, double b) } /* return double m*2^e */ -double dbl (double m, int e) +double +dbl (double m, int e) { if (e>=0) while (e-->0) m *= 2.0; else while (e++<0) m /= 2.0; @@ -1,6 +1,6 @@ /* mpfr.h -- Include file for mpfr. -Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -38,7 +38,7 @@ MA 02111-1307, USA. */ /* Definition of exponent limits */ -#define MPFR_EMAX_DEFAULT ((mp_exp_t) ((1UL<<31)-1)) +#define MPFR_EMAX_DEFAULT ((mp_exp_t) (((unsigned long) 1 <<31)-1)) #define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT)) #define MPFR_EMIN_MIN MPFR_EMIN_DEFAULT diff --git a/shortmul.c b/shortmul.c index 533eeb397..2a0b4ce20 100644 --- a/shortmul.c +++ b/shortmul.c @@ -8,8 +8,9 @@ const double BETA = 0.7; const mp_size_t SHORT_MUL_THRESHOLD = 1; // 2*KARATSUBA_MUL_THRESHOLD; #include <sys/resource.h> + int -cputime () +cputime (void) { struct rusage rus; diff --git a/tests/reuse.c b/tests/reuse.c index 89b29c010..d005eb485 100644 --- a/tests/reuse.c +++ b/tests/reuse.c @@ -1,6 +1,6 @@ /* Test file for in-place operations. -Copyright (C) 2000, 2001 Free Software Foundation. +Copyright (C) 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -25,24 +25,26 @@ MA 02111-1307, USA. */ #include "mpfr.h" #include "mpfr-impl.h" -void (*testfunc) () = NULL; -void test3 (char *, mp_prec_t, mp_rnd_t); -void test4 (char *, mp_prec_t, mp_rnd_t); -void test3a (char *, mp_prec_t, mp_rnd_t); -void test2ui (char *, mp_prec_t, mp_rnd_t); -void testui2 (char *, mp_prec_t, mp_rnd_t); -void test2 (char *, mp_prec_t, mp_rnd_t); -void test2a (char *, mp_prec_t); -int mpfr_compare (mpfr_t, mpfr_t); +void (*testfunc) _PROTO (()) = NULL; +void test3 _PROTO ((char *, mp_prec_t, mp_rnd_t)); +void test4 _PROTO ((char *, mp_prec_t, mp_rnd_t)); +void test3a _PROTO ((char *, mp_prec_t, mp_rnd_t)); +void test2ui _PROTO ((char *, mp_prec_t, mp_rnd_t)); +void testui2 _PROTO ((char *, mp_prec_t, mp_rnd_t)); +void test2 _PROTO ((char *, mp_prec_t, mp_rnd_t)); +void test2a _PROTO ((char *, mp_prec_t)); +int mpfr_compare _PROTO ((mpfr_t, mpfr_t)); /* same than mpfr_cmp, but returns 0 for both NaN's */ -int mpfr_compare (mpfr_t a, mpfr_t b) +int +mpfr_compare (mpfr_t a, mpfr_t b) { return (MPFR_IS_NAN(a)) ? !MPFR_IS_NAN(b) : (MPFR_IS_NAN(b) || mpfr_cmp(a, b)); } -void test3 (char *foo, mp_prec_t prec, mp_rnd_t rnd) +void +test3 (char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref2, ref3; mpfr_t res1; @@ -120,7 +122,8 @@ void test3 (char *foo, mp_prec_t prec, mp_rnd_t rnd) mpfr_clear (res1); } -void test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) +void +test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref, op1,op2,op3,cop1,cop2,cop3, top1,top2,top3; mpfr_t res; @@ -344,7 +347,8 @@ void test4 (char *foo, mp_prec_t prec, mp_rnd_t rnd) } -void test2ui (char *foo, mp_prec_t prec, mp_rnd_t rnd) +void +test2ui (char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref2; unsigned int ref3; @@ -402,7 +406,8 @@ void test2ui (char *foo, mp_prec_t prec, mp_rnd_t rnd) mpfr_clear (res1); } -void testui2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) +void +testui2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref3; unsigned int ref2; @@ -455,7 +460,8 @@ void testui2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) } /* foo(mpfr_ptr, mpfr_srcptr, mp_rndt) */ -void test2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) +void +test2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref2; mpfr_t res1; @@ -497,7 +503,8 @@ void test2 (char *foo, mp_prec_t prec, mp_rnd_t rnd) } /* foo(mpfr_ptr, mpfr_srcptr) */ -void test2a (char *foo, mp_prec_t prec) +void +test2a (char *foo, mp_prec_t prec) { mpfr_t ref1, ref2; mpfr_t res1; @@ -539,7 +546,8 @@ void test2a (char *foo, mp_prec_t prec) } /* one operand, two results */ -void test3a (char *foo, mp_prec_t prec, mp_rnd_t rnd) +void +test3a (char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref2, ref3; mpfr_t res1, res2; diff --git a/tests/tabs.c b/tests/tabs.c index d3d6ba396..926210616 100644 --- a/tests/tabs.c +++ b/tests/tabs.c @@ -31,7 +31,7 @@ MA 02111-1307, USA. */ void check_inexact _PROTO((void)); void -check_inexact () +check_inexact (void) { mp_prec_t p, q; mpfr_t x, y, absx; diff --git a/tests/tadd.c b/tests/tadd.c index aabfc3b5b..eb0dd122e 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -1,6 +1,6 @@ /* Test file for mpfr_add and mpfr_sub. -Copyright (C) 1999-2001 Free Software Foundation. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -45,8 +45,9 @@ void check_inexact _PROTO((void)); /* checks that x+y gives the same results in double and with mpfr with 53 bits of precision */ -void check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, -unsigned int py, unsigned int pz, double z1) +void +check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, + unsigned int py, unsigned int pz, double z1) { double z2; mpfr_t xx,yy,zz; int cert=0; @@ -72,8 +73,9 @@ unsigned int py, unsigned int pz, double z1) mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); } -void checknan (double x, double y, mp_rnd_t rnd_mode, unsigned int px, -unsigned int py, unsigned int pz) +void +checknan (double x, double y, mp_rnd_t rnd_mode, unsigned int px, + unsigned int py, unsigned int pz) { double z2; mpfr_t xx, yy, zz; @@ -95,7 +97,8 @@ unsigned int py, unsigned int pz) #ifdef TEST /* idem than check for mpfr_add(x, x, y) */ -void check3 (double x, double y, mp_rnd_t rnd_mode) +void +check3 (double x, double y, mp_rnd_t rnd_mode) { double z1,z2; mpfr_t xx,yy; int neg; @@ -120,7 +123,8 @@ void check3 (double x, double y, mp_rnd_t rnd_mode) } /* idem than check for mpfr_add(x, y, x) */ -void check4 (double x, double y, mp_rnd_t rnd_mode) +void +check4 (double x, double y, mp_rnd_t rnd_mode) { double z1, z2; mpfr_t xx, yy; @@ -148,7 +152,8 @@ void check4 (double x, double y, mp_rnd_t rnd_mode) } /* idem than check for mpfr_add(x, x, x) */ -void check5 (double x, mp_rnd_t rnd_mode) +void +check5 (double x, mp_rnd_t rnd_mode) { double z1,z2; mpfr_t xx, yy; int neg; @@ -174,7 +179,8 @@ void check5 (double x, mp_rnd_t rnd_mode) mpfr_clear(yy); } -void check2 (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode) +void +check2 (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode) { mpfr_t xx, yy, zz; double z,z2; int u; @@ -197,7 +203,8 @@ void check2 (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode) } #endif -void check2a (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode, +void +check2a (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode, char *res) { mpfr_t xx, yy, zz; @@ -218,7 +225,8 @@ void check2a (double x, int px, double y, int py, int pz, mp_rnd_t rnd_mode, mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); } -void check64 () +void +check64 (void) { mpfr_t x, t, u; @@ -440,7 +448,8 @@ void check64 () /* check case when c does not overlap with a, but both b and c count for rounding */ -void check_case_1b (void) +void +check_case_1b (void) { mpfr_t a, b, c; unsigned int prec_a, prec_b, prec_c, dif; @@ -489,7 +498,8 @@ void check_case_1b (void) } /* check case when c overlaps with a */ -void check_case_2 (void) +void +check_case_2 (void) { mpfr_t a, b, c, d; @@ -521,7 +531,8 @@ void check_case_2 (void) } /* checks when source and destination are equal */ -void check_same () +void +check_same (void) { mpfr_t x; @@ -539,7 +550,7 @@ void check_same () #define MAX_PREC 100 void -check_inexact () +check_inexact (void) { mpfr_t x, y, z, u; mp_prec_t px, py, pu, pz; diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c index cbf864eea..f791c7b76 100644 --- a/tests/tadd_ui.c +++ b/tests/tadd_ui.c @@ -1,6 +1,6 @@ /* Test file for mpfr_add_ui -Copyright (C) 2000, 2001 Free Software Foundation. +Copyright (C) 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -64,7 +64,8 @@ check3 (double x, unsigned long y, unsigned int rnd_mode, double z1) mpfr_clear(xx); mpfr_clear(zz); } -void special (void) +void +special (void) { mpfr_t x, y; @@ -76,7 +77,8 @@ void special (void) mpfr_clear (y); } -int main(argc,argv) int argc; char *argv[]; +int +main (int argc, char *argv[]) { #ifdef TEST double x; unsigned long y, N; int i,rnd_mode,rnd; diff --git a/tests/tagm.c b/tests/tagm.c index 01162d8da..8e5802bf0 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -1,6 +1,6 @@ /* Test file for mpfr_agm. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -34,7 +34,8 @@ void check4 _PROTO((double, double, mp_rnd_t, double)); void check_large _PROTO((void)); void slave _PROTO((int, int)); -double drand_agm() +double +drand_agm(void) { double d; long int *i; @@ -50,7 +51,9 @@ double drand_agm() return d; } -double dagm (double a, double b) { +double +dagm (double a, double b) +{ double u, v, tmpu, tmpv; if ((isnan(a))||(isnan(b))) @@ -74,7 +77,8 @@ double dagm (double a, double b) { #define check(a,b,r) check4(a,b,r,0.0) -void check4 (double a, double b, mp_rnd_t rnd_mode, double res1) +void +check4 (double a, double b, mp_rnd_t rnd_mode, double res1) { mpfr_t ta, tb, tres; double res2; @@ -105,7 +109,8 @@ if (ck==0) printf("%1.20e\n", res1); mpfr_clear(ta); mpfr_clear(tb); mpfr_clear(tres); } -void check_large () +void +check_large (void) { mpfr_t a, b, agm; @@ -120,7 +125,8 @@ void check_large () mpfr_clear(a); mpfr_clear(b); mpfr_clear(agm); } -void slave (int N, int p) +void +slave (int N, int p) { int i; double a,b; diff --git a/tests/tatan.c b/tests/tatan.c index 6d1fe860d..3acb61dea 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -1,6 +1,6 @@ /* Test file for mpfr_arctan. -Copyright (C) 2001 Free Software Foundation. +Copyright (C) 2001, 2002 Free Software Foundation. Written by Paul Zimmermann, INRIA Lorraine. This file is part of the MPFR Library. @@ -29,7 +29,7 @@ void worst_cases _PROTO((void)); int mpfr_arctan_aux2 _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t)); void -worst_cases () +worst_cases (void) { mpfr_t x, y, z; diff --git a/tests/tcmp2.c b/tests/tcmp2.c index 70349fd40..691afa933 100644 --- a/tests/tcmp2.c +++ b/tests/tcmp2.c @@ -1,6 +1,6 @@ /* Test file for mpfr_cmp2. -Copyright (C) 1999-2001 Free Software Foundation. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -27,10 +27,10 @@ MA 02111-1307, USA. */ #include "mpfr-impl.h" #include "mpfr-test.h" -void tcmp2 (double, double, int); -void special (void); -void worst_cases (void); -void set_bit (mpfr_t, unsigned int, int); +void tcmp2 _PROTO ((double, double, int)); +void special _PROTO ((void)); +void worst_cases _PROTO ((void)); +void set_bit _PROTO ((mpfr_t, unsigned int, int)); /* set bit n of x to b, where bit 0 is the most significant one */ void @@ -54,7 +54,7 @@ set_bit (mpfr_t x, unsigned int n, int b) mpfr_cmp2 (x, y) returns 1 + |u| + |v| + k for low(x) >= low(y), and 1 + |u| + |v| + k + 1 otherwise */ void -worst_cases () +worst_cases (void) { mpfr_t x, y; unsigned int i, j, k, b, expected; @@ -184,7 +184,8 @@ tcmp2 (double x, double y, int i) mpfr_clear(xx); mpfr_clear(yy); } -void special () +void +special (void) { mpfr_t x, y; mp_prec_t j; diff --git a/tests/tcos.c b/tests/tcos.c index c3fac3cad..eb19b9d67 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -1,6 +1,6 @@ /* Test file for mpfr_cos. -Copyright (C) 2001 Free Software Foundation, Inc. +Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -27,7 +27,8 @@ MA 02111-1307, USA. */ void check53 _PROTO ((double, double, mp_rnd_t)); -void check53 (double x, double cos_x, mp_rnd_t rnd_mode) +void +check53 (double x, double cos_x, mp_rnd_t rnd_mode) { mpfr_t xx, c; diff --git a/tests/tdiv.c b/tests/tdiv.c index a0b79dcd4..dffb9a24e 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -1,6 +1,6 @@ /* Test file for mpfr_div. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -36,7 +36,8 @@ void check_convergence _PROTO((void)); void check_lowr _PROTO((void)); void check_inexact _PROTO((void)); -void check4 (double N, double D, mp_rnd_t rnd_mode, int p, double Q) +void +check4 (double N, double D, mp_rnd_t rnd_mode, int p, double Q) { mpfr_t q, n, d; double Q2; @@ -59,7 +60,8 @@ void check4 (double N, double D, mp_rnd_t rnd_mode, int p, double Q) mpfr_clear(q); mpfr_clear(n); mpfr_clear(d); } -void check24 (float N, float D, mp_rnd_t rnd_mode, float Q) +void +check24 (float N, float D, mp_rnd_t rnd_mode, float Q) { mpfr_t q, n, d; float Q2; @@ -79,7 +81,8 @@ void check24 (float N, float D, mp_rnd_t rnd_mode, float Q) /* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 2 */ -void check_float() +void +check_float(void) { float b=8388608.0; /* 2^23 */ @@ -124,7 +127,8 @@ void check_float() check24(b*12582913.0, 8388610.0, GMP_RNDD, 1.258291e7); } -void check_convergence () +void +check_convergence (void) { mpfr_t x, y; int i, j; @@ -166,7 +170,8 @@ void check_convergence () mpfr_clear(x); mpfr_clear(y); } -void check_lowr () +void +check_lowr (void) { mpfr_t x, y, z, z2, z3, tmp; int k, c; @@ -296,7 +301,7 @@ void check_lowr () #define MAX_PREC 100 void -check_inexact () +check_inexact (void) { mpfr_t x, y, z, u; mp_prec_t px, py, pu; diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index 1f0e0ff62..cf8eaf966 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -1,6 +1,6 @@ /* Test file for mpfr_div_ui. -Copyright (C) 1999-2001 Free Software Foundation. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -31,7 +31,8 @@ void check _PROTO((double, unsigned long, mp_rnd_t, double)); void special _PROTO((void)); void check_inexact _PROTO((void)); -void check (double d, unsigned long u, mp_rnd_t rnd, double e) +void +check (double d, unsigned long u, mp_rnd_t rnd, double e) { mpfr_t x, y; double f; @@ -119,7 +120,7 @@ special (void) } void -check_inexact () +check_inexact (void) { mpfr_t x, y, z; mp_prec_t px, py; diff --git a/tests/teq.c b/tests/teq.c index 87a421500..fbb9a82b9 100644 --- a/tests/teq.c +++ b/tests/teq.c @@ -1,6 +1,6 @@ /* Test file for mpfr_eq. -Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -26,9 +26,10 @@ MA 02111-1307, USA. */ #include "mpfr.h" #include "mpfr-impl.h" -void teq (mpfr_t); +void teq _PROTO ((mpfr_t)); -void teq (mpfr_t x) +void +teq (mpfr_t x) { mpfr_t y; long k, px, mx; diff --git a/tests/texp.c b/tests/texp.c index 6e389b885..21e19fb0c 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -1,6 +1,6 @@ /* Test file for mpfr_exp. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -40,7 +40,8 @@ int maxu=0; #define check(d, r) check3(d, r, 0.0) /* returns the number of ulp of error */ -int check3 (double d, mp_rnd_t rnd, double e) +int +check3 (double d, mp_rnd_t rnd, double e) { mpfr_t x, y; double f; int u=0, ck=0; @@ -78,7 +79,8 @@ int check3 (double d, mp_rnd_t rnd, double e) } /* computes n bits of exp(d) */ -int check_large (double d, int n, mp_rnd_t rnd) +int +check_large (double d, int n, mp_rnd_t rnd) { mpfr_t x; mpfr_t y; @@ -108,7 +110,8 @@ int check_large (double d, int n, mp_rnd_t rnd) } /* expx is the value of exp(X) rounded towards -infinity */ -int check_worst_case (double X, double expx) +int +check_worst_case (double X, double expx) { mpfr_t x, y; @@ -130,7 +133,8 @@ int check_worst_case (double X, double expx) } /* worst cases communicated by Jean-Michel Muller and Vincent Lefevre */ -int check_worst_cases () +int +check_worst_cases (void) { mpfr_t x; mpfr_t y; @@ -169,7 +173,8 @@ int check_worst_cases () return 0; } -void compare_exp2_exp3 (int n) +void +compare_exp2_exp3 (int n) { mpfr_t x, y, z; int prec; mp_rnd_t rnd; diff --git a/tests/tget_str.c b/tests/tget_str.c index 1a79785c9..07ae5c1ae 100644 --- a/tests/tget_str.c +++ b/tests/tget_str.c @@ -1,6 +1,6 @@ /* Test file for mpfr_get_str. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -34,7 +34,8 @@ void check _PROTO((double, mp_rnd_t)); void check3 _PROTO((double, mp_rnd_t, char *)); void check_small _PROTO((void)); -void check (double d, mp_rnd_t rnd) +void +check (double d, mp_rnd_t rnd) { mpfr_t x; char *str; mp_exp_t e; @@ -45,7 +46,8 @@ void check (double d, mp_rnd_t rnd) free(str); } -void check3 (double d, mp_rnd_t rnd, char *res) +void +check3 (double d, mp_rnd_t rnd, char *res) { mpfr_t x; char *str; mp_exp_t e; @@ -61,7 +63,8 @@ void check3 (double d, mp_rnd_t rnd, char *res) free (str); } -void check_small () +void +check_small (void) { mpfr_t x; char *s; diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c index 87a36548a..92b2119c6 100644 --- a/tests/thyperbolic.c +++ b/tests/thyperbolic.c @@ -1,6 +1,6 @@ /* Test file for hyperbolic function : mpfr_cosh, mpfr_sinh, mpfr_tanh, mpfr_acosh, mpfr_asinh, mpfr_atanh. -Copyright (C) 2001 Free Software Foundation, Inc. +Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -32,7 +32,9 @@ int check_INF _PROTO((void)); -int check_NAN(void){ +int +check_NAN (void) +{ mpfr_t t, ch,sh,th,ach,ash,ath; int tester; @@ -147,7 +149,9 @@ int check_NAN(void){ return(0); } -int check_zero(void){ +int +check_zero (void) +{ mpfr_t t, ch,sh,th,ach,ash,ath; int tester; @@ -271,7 +275,9 @@ int check_zero(void){ } -int check_INF(void){ +int +check_INF (void) +{ mpfr_t t, ch,sh,th,ach,ash,ath; int tester; @@ -497,7 +503,10 @@ int check_INF(void){ return(0); } -int check_O(void){ + +int +check_O (void) +{ mpfr_t t, ch,sh,th,ach,ash,ath; @@ -584,7 +593,8 @@ int check_O(void){ } -int main() +int +main(void) { if (check_INF())printf("Error in evaluation of INF\n"); diff --git a/tests/tlog.c b/tests/tlog.c index 432b71011..a3e2bc049 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -1,6 +1,6 @@ /* Test file for mpfr_log. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -42,7 +42,8 @@ void special _PROTO((void)); #endif -double drand_log () +double +drand_log (void) { double d; INT32 *i; @@ -58,7 +59,8 @@ double drand_log () #define check2(a,rnd,res) check1(a,rnd,res,1,0) #define check(a,r) check2(a,r,0.0) -int check1 (double a, mp_rnd_t rnd_mode, double res1, int ck, int max_ulp) +int +check1 (double a, mp_rnd_t rnd_mode, double res1, int ck, int max_ulp) { mpfr_t ta, tres; double res2; @@ -96,7 +98,8 @@ int check1 (double a, mp_rnd_t rnd_mode, double res1, int ck, int max_ulp) return 0; } -void check3 (double d, unsigned long prec, mp_rnd_t rnd) +void +check3 (double d, unsigned long prec, mp_rnd_t rnd) { mpfr_t x, y; @@ -108,7 +111,8 @@ void check3 (double d, unsigned long prec, mp_rnd_t rnd) mpfr_clear(x); mpfr_clear(y); } -void check4 (int N) +void +check4 (int N) { int i, max=0, sum=0, cur; double d; @@ -128,7 +132,8 @@ void check4 (int N) fprintf(stderr, "max error : %i \t mean error : %f (in ulps)\n",max,d); } -void slave (int N, int p) +void +slave (int N, int p) { int i; double d; @@ -149,7 +154,8 @@ void slave (int N, int p) Cf http://www.ens-lyon.fr/~jmmuller/Intro-to-TMD.htm */ -void check_worst_cases () +void +check_worst_cases (void) { check2(1.00089971802309629645, GMP_RNDD, 8.99313519443722736088e-04); check2(1.00089971802309629645, GMP_RNDN, 8.99313519443722844508e-04); @@ -232,7 +238,8 @@ void check_worst_cases () check2(428.315247165198229595, GMP_RNDU, 6.05985948325268353187); } -void special () +void +special (void) { mpfr_t x, y; diff --git a/tests/tmul.c b/tests/tmul.c index 16d4a162b..5c49f869b 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -1,6 +1,6 @@ /* Test file for mpfr_mul. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -40,8 +40,9 @@ void check_min _PROTO((void)); /* checks that x*y gives the same results in double and with mpfr with 53 bits of precision */ -void check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, - unsigned int py, unsigned int pz, double res) +void +check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, + unsigned int py, unsigned int pz, double res) { double z1, z2; mpfr_t xx, yy, zz; @@ -67,7 +68,8 @@ void check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); } -void check53 (double x, double y, mp_rnd_t rnd_mode, double z1) +void +check53 (double x, double y, mp_rnd_t rnd_mode, double z1) { double z2; mpfr_t xx, yy, zz; @@ -89,7 +91,8 @@ void check53 (double x, double y, mp_rnd_t rnd_mode, double z1) /* checks that x*y gives the same results in double and with mpfr with 24 bits of precision */ -void check24 (float x, float y, mp_rnd_t rnd_mode, float z1) +void +check24 (float x, float y, mp_rnd_t rnd_mode, float z1) { float z2; mpfr_t xx, yy, zz; @@ -110,7 +113,8 @@ void check24 (float x, float y, mp_rnd_t rnd_mode, float z1) /* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 1 */ -void check_float () +void +check_float (void) { check24(8388609.0, 8388609.0, GMP_RNDN, 70368760954880.0); check24(16777213.0, 8388609.0, GMP_RNDN, 140737479966720.0); @@ -154,7 +158,8 @@ void check_float () } /* check sign of result */ -void check_sign () +void +check_sign (void) { mpfr_t a, b; @@ -171,7 +176,7 @@ void check_sign () /* checks that the inexact return value is correct */ void -check_exact () +check_exact (void) { mpfr_t a, b, c, d; mp_prec_t prec; @@ -240,7 +245,8 @@ check_exact () mpfr_clear (d); } -void check_max(void) +void +check_max(void) { mpfr_t xx, yy, zz; @@ -288,7 +294,8 @@ void check_max(void) mpfr_clear(zz); } -void check_min(void) +void +check_min(void) { mpfr_t xx, yy, zz; diff --git a/tests/tout_str.c b/tests/tout_str.c index 37d7acaf8..7269a5017 100644 --- a/tests/tout_str.c +++ b/tests/tout_str.c @@ -1,6 +1,6 @@ /* Test file for mpfr_out_str. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -36,7 +36,8 @@ FILE *fout; void check4 _PROTO((double, mp_rnd_t, int, int)); void check_large _PROTO((void)); -void check4(double d, mp_rnd_t rnd, int base, int prec) +void +check4(double d, mp_rnd_t rnd, int base, int prec) { mpfr_t x; @@ -48,7 +49,8 @@ void check4(double d, mp_rnd_t rnd, int base, int prec) mpfr_clear(x); } -void check_large () +void +check_large (void) { mpfr_t x; mp_exp_t e; char *s; diff --git a/tests/tpow.c b/tests/tpow.c index 7381a98a5..b54a53679 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -1,6 +1,6 @@ /* Test file for mpfr_pow and mpfr_pow_ui. -Copyright (C) 2000, 2001 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -24,10 +24,11 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "mpfr.h" -void check_pow_ui (void); -void check_inexact (mp_prec_t); +void check_pow_ui _PROTO ((void)); +void check_inexact _PROTO ((mp_prec_t)); -void check_pow_ui () +void +check_pow_ui (void) { mpfr_t a, b; @@ -44,16 +45,16 @@ void check_pow_ui () /* check large exponents */ mpfr_set_d (b, 1, GMP_RNDN); - mpfr_pow_ui (a, b, (unsigned long) 4294967295UL, GMP_RNDN); + mpfr_pow_ui (a, b, (unsigned long) 4294967295, GMP_RNDN); mpfr_set_d (a, -1.0/0.0, GMP_RNDN); - mpfr_pow_ui (a, a, 4049053855UL, GMP_RNDN); + mpfr_pow_ui (a, a, (unsigned long) 4049053855, GMP_RNDN); if (mpfr_get_d (a) != -1.0/0.0) { fprintf (stderr, "Error for (-Inf)^4049053855\n"); exit (1); } mpfr_set_d (a, -1.0/0.0, GMP_RNDN); - mpfr_pow_ui (a, a, 30002752UL, GMP_RNDN); + mpfr_pow_ui (a, a, (unsigned long) 30002752, GMP_RNDN); if (mpfr_get_d (a) != 1.0/0.0) { fprintf (stderr, "Error for (-Inf)^30002752\n"); exit (1); } diff --git a/tests/trandom.c b/tests/trandom.c index cf9c05a9b..2c1396cee 100644 --- a/tests/trandom.c +++ b/tests/trandom.c @@ -1,6 +1,6 @@ /* Test file for the various mpfr_random fonctions. -Copyright (C) 1999, 2000, 2001 Free Software Foundation. +Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -27,11 +27,12 @@ MA 02111-1307, USA. */ #include "mpfr.h" #include "mpfr-impl.h" -void test_random (unsigned long, unsigned long, int); -void test_random2 (unsigned long, unsigned long, int); -void test_urandomb (unsigned long, unsigned long, int); +void test_random _PROTO ((unsigned long, unsigned long, int)); +void test_random2 _PROTO ((unsigned long, unsigned long, int)); +void test_urandomb _PROTO ((unsigned long, unsigned long, int)); -void test_random (unsigned long nbtests, unsigned long prec, int verbose) +void +test_random (unsigned long nbtests, unsigned long prec, int verbose) { mpfr_t x; int *tab, size_tab, k; @@ -76,7 +77,8 @@ void test_random (unsigned long nbtests, unsigned long prec, int verbose) return; } -void test_random2 (unsigned long nbtests, unsigned long prec, int verbose) +void +test_random2 (unsigned long nbtests, unsigned long prec, int verbose) { mpfr_t x; int *tab, size_tab, k; @@ -118,7 +120,8 @@ void test_random2 (unsigned long nbtests, unsigned long prec, int verbose) return; } -void test_urandomb (unsigned long nbtests, unsigned long prec, int verbose) +void +test_urandomb (unsigned long nbtests, unsigned long prec, int verbose) { mpfr_t x; int *tab, size_tab, k; diff --git a/tests/tset.c b/tests/tset.c index 9d93f1d7c..1ae5951d6 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -26,7 +26,7 @@ MA 02111-1307, USA. */ #include "mpfr.h" int -main () +main (void) { mp_prec_t p, q; mpfr_t x, y, z, u; diff --git a/tests/tset_z.c b/tests/tset_z.c index 858671f6a..c76c624c5 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -1,6 +1,6 @@ /* Test file for mpfr_set_z. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -28,7 +28,9 @@ MA 02111-1307, USA. */ void check _PROTO((long, unsigned char)); void check_large _PROTO((void)); -void check(long i, unsigned char rnd) { +void +check(long i, unsigned char rnd) +{ mpfr_t f; mpz_t z; mpfr_init2(f, 53); mpz_init(z); @@ -41,7 +43,8 @@ void check(long i, unsigned char rnd) { mpfr_clear(f); mpz_clear(z); } -void check_large () +void +check_large (void) { mpz_t z; mpfr_t x,y; diff --git a/tests/tsin.c b/tests/tsin.c index b302b025c..29d9a6b48 100644 --- a/tests/tsin.c +++ b/tests/tsin.c @@ -1,6 +1,6 @@ /* Test file for mpfr_sin. -Copyright (C) 2001 Free Software Foundation, Inc. +Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -27,7 +27,8 @@ MA 02111-1307, USA. */ void check53 _PROTO ((double, double, mp_rnd_t)); -void check53 (double x, double sin_x, mp_rnd_t rnd_mode) +void +check53 (double x, double sin_x, mp_rnd_t rnd_mode) { mpfr_t xx, s; diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 9a6a9f6ec..366e62c53 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -1,6 +1,6 @@ /* Test file for mpfr_sqrt. -Copyright (C) 1999, 2001 Free Software Foundation, Inc. +Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -78,7 +78,8 @@ check3 (double a, mp_rnd_t rnd_mode, double Q) mpfr_clear(q); } -void check4 (double a, mp_rnd_t rnd_mode, char *Q) +void +check4 (double a, mp_rnd_t rnd_mode, char *Q) { mpfr_t q, res; @@ -98,7 +99,8 @@ void check4 (double a, mp_rnd_t rnd_mode, char *Q) mpfr_clear(q); } -void check24 (float a, mp_rnd_t rnd_mode, float Q) +void +check24 (float a, mp_rnd_t rnd_mode, float Q) { mpfr_t q; float Q2; @@ -117,7 +119,8 @@ void check24 (float a, mp_rnd_t rnd_mode, float Q) /* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 3 */ -void check_float () +void +check_float (void) { float b = 8388608.0; /* 2^23 */ @@ -166,7 +169,8 @@ void check_float () check24(b*10873622.0, GMP_RNDD, 9.550631e6); } -void special () +void +special (void) { mpfr_t x, z; int inexact; diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c index 9b8bbba0f..3206d49e2 100644 --- a/tests/tsqrt_ui.c +++ b/tests/tsqrt_ui.c @@ -1,6 +1,6 @@ /* Test file for mpfr_sqrt_ui. -Copyright (C) 2000, 2001 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -30,7 +30,8 @@ void check _PROTO((unsigned long, mp_rnd_t, double)); int maxulp=0; -void check (unsigned long a, mp_rnd_t rnd_mode, double Q) +void +check (unsigned long a, mp_rnd_t rnd_mode, double Q) { mpfr_t q; double Q2; int u, ck; diff --git a/tests/tsub.c b/tests/tsub.c index 8a48024ae..282b1a0af 100644 --- a/tests/tsub.c +++ b/tests/tsub.c @@ -33,7 +33,7 @@ void check_two_sum _PROTO((mp_prec_t)); void check_inexact _PROTO((void)); void -check_diverse () +check_diverse (void) { mpfr_t x, y, z; double res, got; @@ -254,7 +254,7 @@ check_diverse () } void -bug_ddefour() +bug_ddefour(void) { mpfr_t ex, ex1, ex2, ex3, tot, tot1; @@ -336,7 +336,7 @@ check_two_sum (mp_prec_t p) #define MAX_PREC 100 void -check_inexact () +check_inexact (void) { mpfr_t x, y, z, u; mp_prec_t px, py, pu, pz; @@ -398,7 +398,7 @@ check_inexact () } int -main() +main(void) { mp_prec_t p; unsigned i; diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c index a6167fed5..5436f3b17 100644 --- a/tests/tsub_ui.c +++ b/tests/tsub_ui.c @@ -1,6 +1,6 @@ /* Test file for mpfr_sub_ui -Copyright (C) 2000-2001 Free Software Foundation. +Copyright (C) 2000, 2001, 2002 Free Software Foundation. This file is part of the MPFR Library. @@ -38,7 +38,8 @@ void check3 _PROTO ((double, unsigned long, mp_rnd_t, double)); /* checks that x+y gives the same results in double and with mpfr with 53 bits of precision */ -void check3 (double x, unsigned long y, mp_rnd_t rnd_mode, double z1) +void +check3 (double x, unsigned long y, mp_rnd_t rnd_mode, double z1) { double z2; mpfr_t xx,zz; @@ -111,7 +112,8 @@ check_two_sum (mp_prec_t p) mpfr_clear (w); } -int main(argc,argv) int argc; char *argv[]; +int +main (int argc, char *argv[]) { mp_prec_t p; int k; diff --git a/tests/ttan.c b/tests/ttan.c index 3bb2d3189..d77614058 100644 --- a/tests/ttan.c +++ b/tests/ttan.c @@ -1,6 +1,6 @@ /* Test file for mpfr_tan. -Copyright (C) 2001 Free Software Foundation, Inc. +Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -27,7 +27,8 @@ MA 02111-1307, USA. */ void check53 _PROTO ((double, double, mp_rnd_t)); -void check53 (double x, double tan_x, mp_rnd_t rnd_mode) +void +check53 (double x, double tan_x, mp_rnd_t rnd_mode) { mpfr_t xx, s; diff --git a/tests/tui_div.c b/tests/tui_div.c index c145aa784..7b1df1bad 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -1,6 +1,6 @@ /* Test file for mpfr_ui_div. -Copyright (C) 2000, 2001 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -33,7 +33,8 @@ void check_inexact _PROTO((void)); /* checks that y/x gives the same results in double and with mpfr with 53 bits of precision */ -void check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) +void +check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) { double z2; mpfr_t xx, zz; @@ -57,7 +58,7 @@ void check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) } void -check_inexact () +check_inexact (void) { mpfr_t x, y, z; mp_prec_t px, py; diff --git a/tests/tui_sub.c b/tests/tui_sub.c index ab8ec651c..c51a48207 100644 --- a/tests/tui_sub.c +++ b/tests/tui_sub.c @@ -33,7 +33,7 @@ void check _PROTO ((unsigned long, double, mp_rnd_t, double)); void check_two_sum _PROTO ((mp_prec_t)); void -special () +special (void) { mpfr_t x, y, res; int inexact; diff --git a/tests/tzeta.c b/tests/tzeta.c index dcba3d217..3eb76ed8f 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -28,7 +28,8 @@ MA 02111-1307, USA. */ /* #define DEBUG */ -int main() +int +main(void) { mpfr_t p,result,res_p; #ifdef DEBUG |