diff options
-rw-r--r-- | configure.in | 19 | ||||
-rw-r--r-- | mpfr-test.h | 2 | ||||
-rw-r--r-- | rnd_mode.c | 2 | ||||
-rw-r--r-- | tests/tadd.c | 10 | ||||
-rw-r--r-- | tests/tadd_ui.c | 4 | ||||
-rw-r--r-- | tests/tagm.c | 2 | ||||
-rw-r--r-- | tests/tdiv.c | 6 | ||||
-rw-r--r-- | tests/tdiv_ui.c | 4 | ||||
-rw-r--r-- | tests/texp.c | 6 | ||||
-rw-r--r-- | tests/tget_d.c | 2 | ||||
-rw-r--r-- | tests/tget_str.c | 4 | ||||
-rw-r--r-- | tests/tlog.c | 2 | ||||
-rw-r--r-- | tests/tmul.c | 6 | ||||
-rw-r--r-- | tests/tset_q.c | 4 | ||||
-rw-r--r-- | tests/tsqrt.c | 4 | ||||
-rw-r--r-- | tests/tsqrt_ui.c | 4 | ||||
-rw-r--r-- | tests/tsub_ui.c | 4 | ||||
-rw-r--r-- | tests/tui_div.c | 4 | ||||
-rw-r--r-- | tests/tui_sub.c | 4 |
19 files changed, 39 insertions, 54 deletions
diff --git a/configure.in b/configure.in index 36ccf17f3..708f6b064 100644 --- a/configure.in +++ b/configure.in @@ -57,7 +57,7 @@ case $OS_TYPE in ;; esac -AC_CHECK_HEADERS(fpu_control.h) +AC_CHECK_HEADERS(fenv.h fpu_control.h) dnl Tests concerning the include directories. AC_MSG_CHECKING(for gmp files) @@ -97,22 +97,7 @@ default target architecture may be different, hence the error.])], ) dnl Check random functions -AC_MSG_CHECKING(for rand48 functions) -AC_TRY_RUN([#include <stdlib.h> -int main() { long int l = lrand48 (); return 0; }], - [AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RAND48)], - AC_MSG_RESULT(no), - AC_MSG_RESULT(no) -) - -dnl Check for ISOC9X interface for rounding modes -AC_MSG_CHECKING(for fenv.h) -AC_TRY_CPP([#include <fenv.h>], - [AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_FENV)], - AC_MSG_RESULT(no) -) +AC_CHECK_FUNCS(lrand48) dnl Check whether 0/0, 1/0, -1/0 are valid expressions AC_MSG_CHECKING(for 0/0 as a valid expression) diff --git a/mpfr-test.h b/mpfr-test.h index 27757e2cf..c1d4a3e67 100644 --- a/mpfr-test.h +++ b/mpfr-test.h @@ -48,7 +48,7 @@ MA 02111-1307, USA. */ /* generates a random long int, a random double, and corresponding seed initializing */ -#ifdef HAVE_RAND48 +#ifdef HAVE_LRAND48 #define LONG_RAND lrand48 #define DBL_RAND drand48 #define SEED_RAND srand48 diff --git a/rnd_mode.c b/rnd_mode.c index 481cf1881..95f344a56 100644 --- a/rnd_mode.c +++ b/rnd_mode.c @@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H #include <stdio.h> #include <stdlib.h> #include <fenv.h> diff --git a/tests/tadd.c b/tests/tadd.c index 226c5800d..fdbc255ad 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -56,7 +56,7 @@ check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_set_d(xx, x, rnd_mode); mpfr_set_d(yy, y, rnd_mode); mpfr_add(zz, xx, yy, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); if (px==53 && py==53 && pz==53) cert=1; #endif @@ -84,7 +84,7 @@ checknan (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_set_d(xx, x, rnd_mode); mpfr_set_d(yy, y, rnd_mode); mpfr_add(zz, xx, yy, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (MPFR_IS_NAN(zz) == 0) { printf("Error, not an MPFR_NAN for xx = %1.20e, y = %1.20e\n", x, y); exit(1); } @@ -94,7 +94,7 @@ checknan (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); } -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H /* idem than check for mpfr_add(x, x, y) */ void check3 (double x, double y, mp_rnd_t rnd_mode) @@ -640,7 +640,7 @@ check_inexact (void) int main (int argc, char *argv[]) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int prec, rnd_mode; int rnd; double y; @@ -835,7 +835,7 @@ main (int argc, char *argv[]) check53(9007199254740994.0, -1.0, GMP_RNDN, 9007199254740992.0); check53(9007199254740996.0, -1.0, GMP_RNDN, 9007199254740996.0); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H prec = (argc<2) ? 53 : atoi(argv[1]); rnd_mode = (argc<3) ? -1 : atoi(argv[2]); /* Comparing to double precision using machine arithmetic */ diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c index 05bc796f3..24903f5a5 100644 --- a/tests/tadd_ui.c +++ b/tests/tadd_ui.c @@ -47,7 +47,7 @@ check3 (double x, unsigned long y, unsigned int rnd_mode, double z1) mpfr_init2(zz, 53); mpfr_set_d(xx, x, rnd_mode); mpfr_add_ui(zz, xx, y, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = x+y; @@ -77,7 +77,7 @@ special (void) int main (int argc, char *argv[]) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H double x; unsigned long y, N; int i,rnd_mode,rnd; mpfr_test_init (); diff --git a/tests/tagm.c b/tests/tagm.c index 8a2e11343..c9e90d30b 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -89,7 +89,7 @@ check4 (double a, double b, mp_rnd_t rnd_mode, double res1) mpfr_set_d(tb, b, rnd_mode); mpfr_agm(tres, ta, tb, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif diff --git a/tests/tdiv.c b/tests/tdiv.c index aeb876f79..dcb976f31 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -47,7 +47,7 @@ check4 (double N, double D, mp_rnd_t rnd_mode, int p, double Q) mpfr_set_d(n, N, rnd_mode); mpfr_set_d(d, D, rnd_mode); mpfr_div(q, n, d, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (Q==0.0) Q = N/D; @@ -451,7 +451,7 @@ main (int argc, char *argv[]) { mpfr_t x, y, z; -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int N, i; double n, d, e; @@ -494,7 +494,7 @@ main (int argc, char *argv[]) check53(1.04636807108079349236e-189, 3.72295730823253012954e-292, GMP_RNDZ, 2.810583051186143125e102); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H N = (argc>1) ? atoi(argv[1]) : 100000; SEED_RAND (time(NULL)); for (i=0;i<N;i++) diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index 63fb04ab7..03c4bbaa0 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -37,7 +37,7 @@ check (double d, unsigned long u, mp_rnd_t rnd, double e) double f; mpfr_init2(x, 53); mpfr_init2(y, 53); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd); #endif if (e==0.0) e = d / u; @@ -174,7 +174,7 @@ int main (int argc, char **argv) { mpfr_t x; -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int i; unsigned long u; double d; diff --git a/tests/texp.c b/tests/texp.c index 81a3f13db..1ae7da0e2 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -46,7 +46,7 @@ check3 (double d, mp_rnd_t rnd, double e) mpfr_t x, y; double f; int u=0, ck=0; mpfr_init2(x, 53); mpfr_init2(y, 53); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd); #endif if (e==0.0) e = exp(d); else ck=1; /* really check */ @@ -216,7 +216,7 @@ compare_exp2_exp3 (int n) int main (int argc, char *argv[]) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int i, N, s=0, e, maxe=0; double lo, hi; #endif @@ -272,7 +272,7 @@ main (int argc, char *argv[]) check3(5.30015757134837031117e+02, GMP_RNDD, 1.5237672861171573939e230); check3(5.16239362447650933063e+02, GMP_RNDZ, 1.5845518406744492105e224); check3(6.00812634798592370977e-01, GMP_RNDN, 1.823600119339019443); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H SEED_RAND (time(NULL)); N = (argc==1) ? 0 : atoi(argv[1]); lo = (argc>=3) ? atof(argv[2]) : -7.083964185e2; diff --git a/tests/tget_d.c b/tests/tget_d.c index 0bd23e5f7..ce64ab4f5 100644 --- a/tests/tget_d.c +++ b/tests/tget_d.c @@ -61,7 +61,7 @@ int main (void) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_t half, x, y; mp_rnd_t rnd_mode; diff --git a/tests/tget_str.c b/tests/tget_str.c index 6a2994bed..3059db58e 100644 --- a/tests/tget_str.c +++ b/tests/tget_str.c @@ -26,7 +26,7 @@ MA 02111-1307, USA. */ #include <time.h> #include "gmp.h" #include "mpfr.h" -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H #include "mpfr-test.h" #endif @@ -105,7 +105,7 @@ check_small (void) int main (int argc, char *argv[]) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int i; double d; diff --git a/tests/tlog.c b/tests/tlog.c index 6343012af..bc2c35fec 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -67,7 +67,7 @@ check1 (double a, mp_rnd_t rnd_mode, double res1, int ck, int max_ulp) int diff=0; /* ck=1 iff res1 is certified correct */ -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (ck==0 && res1==0.0) res1=log(a); diff --git a/tests/tmul.c b/tests/tmul.c index a6eb050d8..0883f8965 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -52,7 +52,7 @@ check (double x, double y, mp_rnd_t rnd_mode, unsigned int px, mpfr_set_d(xx, x, rnd_mode); mpfr_set_d(yy, y, rnd_mode); mpfr_mul(zz, xx, yy, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif z1 = (res==0.0) ? x*y : res; @@ -349,7 +349,7 @@ check_min(void) int main (int argc, char *argv[]) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H double x, y, z; int i, prec, rnd_mode; @@ -389,7 +389,7 @@ main (int argc, char *argv[]) 49, 3, 2, 0.09375); check_max(); check_min(); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H SEED_RAND (time(NULL)); prec = (argc<2) ? 53 : atoi(argv[1]); rnd_mode = (argc<3) ? -1 : atoi(argv[2]); diff --git a/tests/tset_q.c b/tests/tset_q.c index 5a8886c5a..7222576b9 100644 --- a/tests/tset_q.c +++ b/tests/tset_q.c @@ -40,7 +40,7 @@ check (long int n, long int d, mp_rnd_t rnd, double y) mpfr_init2 (t, mpfr_get_prec (x) + mp_bits_per_limb); mpq_init (q); mpq_set_si (q, n, d); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode (rnd); y = (double) n / d; #endif @@ -80,7 +80,7 @@ check (long int n, long int d, mp_rnd_t rnd, double y) int main (void) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H long int i, n; unsigned long int d; double y; diff --git a/tests/tsqrt.c b/tests/tsqrt.c index e8c7dabf8..eae907f6a 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -49,7 +49,7 @@ check3 (double a, mp_rnd_t rnd_mode, double Q) ck = (Q!=-1.0); /* if ck=1, then Q is certified correct */ mpfr_init2(q, 53); mpfr_set_d(q, a, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif mpfr_sqrt(q, q, rnd_mode); @@ -326,7 +326,7 @@ main (void) double a; mp_prec_t p; int k; -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int i; mpfr_test_init (); diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c index 69d475c86..843c11048 100644 --- a/tests/tsqrt_ui.c +++ b/tests/tsqrt_ui.c @@ -37,7 +37,7 @@ check (unsigned long a, mp_rnd_t rnd_mode, double Q) mpfr_t q; double Q2; int u, ck; mpfr_init2(q, 53); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif mpfr_sqrt_ui(q, a, rnd_mode); @@ -59,7 +59,7 @@ check (unsigned long a, mp_rnd_t rnd_mode, double Q) int main (void) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H int i; unsigned long a; diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c index 29c433ef8..ad5645cc9 100644 --- a/tests/tsub_ui.c +++ b/tests/tsub_ui.c @@ -47,7 +47,7 @@ check3 (double x, unsigned long y, mp_rnd_t rnd_mode, double z1) mpfr_set_prec(zz, 53); mpfr_set_d(xx, x, rnd_mode); mpfr_sub_ui(zz, xx, y, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = x-y; @@ -114,7 +114,7 @@ main (int argc, char *argv[]) { mp_prec_t p; int k; -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H double x; unsigned long y, N; int i,rnd_mode,rnd; mpfr_test_init (); diff --git a/tests/tui_div.c b/tests/tui_div.c index bb990d5d9..30c18bcdc 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -44,7 +44,7 @@ check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) mpfr_init2(zz, 53); mpfr_set_d(xx, x, rnd_mode); mpfr_ui_div(zz, y, xx, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = y/x; @@ -152,7 +152,7 @@ check_nan (void) int main (int argc, char *argv[]) { -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H double x; unsigned long y, N; int i, rnd_mode, rnd; diff --git a/tests/tui_sub.c b/tests/tui_sub.c index 6a3a0c6dc..55e037fb2 100644 --- a/tests/tui_sub.c +++ b/tests/tui_sub.c @@ -140,7 +140,7 @@ check (unsigned long y, double x, mp_rnd_t rnd_mode, double z1) mpfr_init2(zz, 53); mpfr_set_d(xx, x, rnd_mode); mpfr_ui_sub(zz, y, xx, rnd_mode); -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H mpfr_set_machine_rnd_mode(rnd_mode); #endif if (z1==0.0) z1 = y-x; @@ -204,7 +204,7 @@ main (int argc, char *argv[]) { mp_prec_t p; unsigned k; -#ifdef HAVE_FENV +#ifdef HAVE_FENV_H double x; unsigned long y, N; int i, rnd_mode, rnd; |