summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpfr/ChangeLog33
-rw-r--r--mpfr/Makefile.am4
-rw-r--r--mpfr/Makefile.in3
-rw-r--r--mpfr/mpfi.h136
-rw-r--r--mpfr/mpfr.texi12
-rw-r--r--mpfr/rnd_mode.c2
-rw-r--r--mpfr/tests/Makefile.in1
-rw-r--r--mpfr/tests/tadd.c10
-rw-r--r--mpfr/tests/tadd_ui.c4
-rw-r--r--mpfr/tests/tagm.c2
-rw-r--r--mpfr/tests/tdiv.c6
-rw-r--r--mpfr/tests/tdiv_ui.c4
-rw-r--r--mpfr/tests/texp.c6
-rw-r--r--mpfr/tests/tget_d.c2
-rw-r--r--mpfr/tests/tget_str.c4
-rw-r--r--mpfr/tests/tlog.c2
-rw-r--r--mpfr/tests/tmul.c6
-rw-r--r--mpfr/tests/tset_q.c4
-rw-r--r--mpfr/tests/tsqrt.c4
-rw-r--r--mpfr/tests/tsqrt_ui.c4
-rw-r--r--mpfr/tests/tsub_ui.c4
-rw-r--r--mpfr/tests/tui_div.c4
-rw-r--r--mpfr/tests/tui_sub.c4
23 files changed, 220 insertions, 41 deletions
diff --git a/mpfr/ChangeLog b/mpfr/ChangeLog
index a812e3a15..0e7f8eee8 100644
--- a/mpfr/ChangeLog
+++ b/mpfr/ChangeLog
@@ -1,5 +1,38 @@
+2002-04-09 Vincent Lefevre <lefevre@greux.loria.fr>
+
+ * INSTALL: Possible tconst_log2 crash under Solaris.
+
+ * configure.in:
+ Under OSF, use option -ffloat-store only when the compiler is gcc.
+
+ * Makefile.am:
+ include_HEADERS should contain only mpfr.h and mpf2mpfr.h.
+
+ * configure.in: Added code to support fesetround under Solaris.
+
+ * INSTALL: "In case of problem" update.
+
+ * INSTALL: Old URL removed.
+
+ * INSTALL:
+ Renaming: DIR -> GMPINSTALL, GMPDIR -> GMPBUILD. Bug on IRIX updated.
+
+ * INSTALL: Removed note about stack-alloc.h.
+
+ * tests/tui_div.c, tests/tui_sub.c, tests/tadd.c, tests/tadd_ui.c, tests/tagm.c, tests/tdiv.c, tests/tdiv_ui.c, tests/texp.c, tests/tget_d.c, tests/tget_str.c, tests/tlog.c, tests/tmul.c, tests/tset_q.c, tests/tsqrt.c, tests/tsqrt_ui.c, tests/tsub_ui.c, configure.in, rnd_mode.c:
+ Check for fenv.h -> check for fesetround.
+
+ * README.dev: Added note concerning patch submission.
+
+2002-04-08 Vincent Lefevre <lefevre@greux.loria.fr>
+
+ * mpfr.texi:
+ Note about overflows. Functions mpfr_{div,mul}_{si,ui} described.
+
2002-04-07 Vincent Lefevre <lefevre@greux.loria.fr>
+ * ChangeLog: Update for the next (and last?) pre-release.
+
* configure.in: Stricter test for HAVE_INFS.
* BUGS: Update.
diff --git a/mpfr/Makefile.am b/mpfr/Makefile.am
index f8b42ba3b..d2bc81ef3 100644
--- a/mpfr/Makefile.am
+++ b/mpfr/Makefile.am
@@ -43,6 +43,6 @@ TEXINFO_TEX = ../texinfo.tex
# Override automake default AR=ar with the value from GMP_PROG_AR.
AR = @AR@
-libmpfr_a_SOURCES= cputime.h mpfr.h mpfr-impl.h exceptions.c save_expo.c extract.c uceil_exp2.c uceil_log2.c ufloor_log2.c add.c add1.c add_one_ulp.c add_ui.c agm.c clear.c cmp.c cmp_abs.c cmp_ui.c div_2exp.c div_2si.c div_2ui.c div.c div_ui.c dump.c eq.c exp2.c exp3.c exp.c get_d.c get_str.c init.c inp_str.c isinteger.c isinf.c isnan.c isnum.c const_log2.c log.c mul_2exp.c mul_2si.c mul_2ui.c mul.c mul_ui.c neg.c out_str.c const_pi.c pow.c pow_si.c pow_ui.c print_raw.c print_rnd_mode.c random2.c random.c reldiff.c rnd_mode.c round_prec.c set.c set_d.c set_dfl_prec.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c sub_one_ulp.c sub_ui.c rint.c ui_div.c ui_sub.c urandomb.c get_z_exp.c swap.c factorial.c cosh.c sinh.c tanh.c acosh.c asinh.c atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c fma.c hypot.c log1p.c expm1.c log2.c log10.c ui_pow.c ui_pow_ui.c minmax.c dim.c copysign.c gmp_op.c init2.c acos.c sin_cos.c set_nan.c set_inf.c
+libmpfr_a_SOURCES = cputime.h mpfr.h mpf2mpfr.h mpfi.h mpfr-impl.h mpfr-math.h mpfr-test.h exceptions.c save_expo.c extract.c uceil_exp2.c uceil_log2.c ufloor_log2.c add.c add1.c add_one_ulp.c add_ui.c agm.c clear.c cmp.c cmp_abs.c cmp_ui.c div_2exp.c div_2si.c div_2ui.c div.c div_ui.c dump.c eq.c exp2.c exp3.c exp.c get_d.c get_str.c init.c inp_str.c isinteger.c isinf.c isnan.c isnum.c const_log2.c log.c mul_2exp.c mul_2si.c mul_2ui.c mul.c mul_ui.c neg.c out_str.c const_pi.c pow.c pow_si.c pow_ui.c print_raw.c print_rnd_mode.c random2.c random.c reldiff.c rnd_mode.c round_prec.c set.c set_d.c set_dfl_prec.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c sub_one_ulp.c sub_ui.c rint.c ui_div.c ui_sub.c urandomb.c get_z_exp.c swap.c factorial.c cosh.c sinh.c tanh.c acosh.c asinh.c atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c fma.c hypot.c log1p.c expm1.c log2.c log10.c ui_pow.c ui_pow_ui.c minmax.c dim.c copysign.c gmp_op.c init2.c acos.c sin_cos.c set_nan.c set_inf.c
-EXTRA_DIST = generic.c mpfr-test.h mpfr-math.h mpf2mpfr.h
+EXTRA_DIST = generic.c
diff --git a/mpfr/Makefile.in b/mpfr/Makefile.in
index 7ba06de41..a7e590e0b 100644
--- a/mpfr/Makefile.in
+++ b/mpfr/Makefile.in
@@ -86,7 +86,6 @@ BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
-CFLAGS_IEEE_WITH_INEXACT = @CFLAGS_IEEE_WITH_INEXACT@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -229,7 +228,7 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README $(include_HEADERS) AUTHORS COPYING ChangeLog \
- Makefile.am Makefile.in NEWS TODO
+ Makefile.am Makefile.in NEWS TODO acinclude.m4
DIST_SUBDIRS = $(SUBDIRS)
SOURCES = $(libmpfr_a_SOURCES)
diff --git a/mpfr/mpfi.h b/mpfr/mpfi.h
new file mode 100644
index 000000000..558d5769e
--- /dev/null
+++ b/mpfr/mpfi.h
@@ -0,0 +1,136 @@
+/* mpfi.h -- Include file for mpfi.
+
+Copyright 1999 PolKA project, Inria Lorraine and Loria
+
+This file is part of the MPFR Library.
+
+The MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the MPFR Library; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#ifndef _mpfi_h
+#define _mpfi_h
+
+#define MPFI_RNDD GMP_RNDD
+#define MPFI_RNDU GMP_RNDU
+
+#include <math.h>
+
+/* Machine dependant implementations */
+
+#include "gmp.h"
+#include "mpfr.h"
+
+typedef struct {
+ __mpfr_struct left;
+ __mpfr_struct right;
+}__mpfi_struct;
+
+typedef __mpfi_struct mpfi_t[1];
+typedef __mpfi_struct *mpfi_ptr;
+typedef __gmp_const __mpfi_struct *mpfi_srcptr;
+
+/* Gestion de la precision */
+
+void mpfi_set_prec(const unsigned int);
+
+unsigned int mpfi_get_prec();
+
+/* Gestion de memoire */
+
+void mpfi_clear(mpfi_ptr);
+
+/* initializations */
+
+void mpfi_init (mpfi_ptr);
+void mpfi_set (mpfi_ptr, mpfi_srcptr);
+void mpfi_set_si (mpfi_ptr, const long);
+void mpfi_set_ui (mpfi_ptr, const unsigned long);
+void mpfi_set_d (mpfi_ptr, const double);
+
+
+/* void mpfi_set_str (mpfi_ptr, const char *); */
+
+/* arithmetic operations */
+
+void mpfi_add (mpfi_ptr, mpfi_srcptr, mpfi_srcptr);
+void mpfi_sub (mpfi_ptr, mpfi_srcptr, mpfi_srcptr);
+void mpfi_mul (mpfi_ptr, mpfi_srcptr, mpfi_srcptr);
+void mpfi_div (mpfi_ptr, mpfi_srcptr, mpfi_srcptr);
+
+void mpfi_add_d (mpfi_ptr, mpfi_srcptr, const double);
+void mpfi_sub_d (mpfi_ptr, mpfi_srcptr, const double);
+void mpfi_mul_d (mpfi_ptr, mpfi_srcptr, const double);
+void mpfi_div_d (mpfi_ptr, mpfi_srcptr, const double);
+
+#define mpfi_add_si(a,b,c) mpfi_add_d(a,b,(double) c);
+#define mpfi_sub_si(a,b,c) mpfi_sub_d(a,b,(double) c);
+#define mpfi_mul_si(a,b,c) mpfi_mul_d(a,b,(double) c);
+#define mpfi_div_si(a,b,c) mpfi_div_d(a,b,(double) c);
+
+/* destructive arithmetic operations */
+
+void mpfi_dadd (mpfi_ptr, mpfi_srcptr);
+void mpfi_dsub (mpfi_ptr, mpfi_srcptr);
+void mpfi_dmul (mpfi_ptr, mpfi_srcptr);
+void mpfi_ddiv (mpfi_ptr, mpfi_srcptr);
+
+void mpfi_dadd_d (mpfi_ptr, const double);
+void mpfi_dsub_d (mpfi_ptr, const double);
+void mpfi_dmul_d (mpfi_ptr, const double);
+void mpfi_ddiv_d (mpfi_ptr, const double);
+
+#define mpfi_dadd_si(a,c) mpfi_dadd_d(a,(double) c);
+#define mpfi_dsub_si(a,c) mpfi_dsub_d(a,(double) c);
+#define mpfi_dmul_si(a,c) mpfi_dmul_d(a,(double) c);
+#define mpfi_ddiv_si(a,c) mpfi_ddiv_d(a,(double) c);
+
+/* destructive composite arithmetic operations */
+
+
+/* various operations */
+
+void mpfi_neg(mpfi_ptr, mpfi_srcptr);
+void mpfi_inv(mpfi_ptr, mpfi_srcptr);
+void mpfi_mul_2exp(mpfi_ptr, mpfi_srcptr,unsigned long);
+
+/* interval manipulation */
+
+void mpfi_set_left (mpfi_ptr, mpfr_srcptr);
+void mpfi_set_right (mpfi_ptr, mpfr_srcptr);
+void mpfi_get_left (mpfi_srcptr, mpfr_ptr);
+void mpfi_get_right (mpfi_srcptr, mpfr_ptr);
+
+
+/* customizable comparison functions */
+
+int (*mpfi_cmp) (mpfi_srcptr,mpfi_srcptr);
+int (*mpfi_cmp_d) (mpfi_srcptr,const double);
+int (*mpfi_cmp_ui) (mpfi_srcptr,const unsigned long);
+int (*mpfi_cmp_si) (mpfi_srcptr,const long);
+
+int (*mpfi_is_pos) (mpfi_srcptr);
+int (*mpfi_is_neg) (mpfi_srcptr);
+int (*mpfi_is_zero) (mpfi_srcptr);
+
+
+/* Customizable error handling */
+
+#ifdef MPFI_USE_CHECK_ERROR
+int reset_error();
+int get_error();
+char * get_error_str();
+#endif
+
+#endif
diff --git a/mpfr/mpfr.texi b/mpfr/mpfr.texi
index 05f8a8323..25fbc218b 100644
--- a/mpfr/mpfr.texi
+++ b/mpfr/mpfr.texi
@@ -580,6 +580,10 @@ corresponding to the rounding mode @var{rnd} or a null pointer if
@comment node-name, next, previous, up
@section Exceptions
+Note: Overflow handling is still experimental and currently implemented
+very partially. If an overflow occurs internally at the wrong place,
+anything can happen (crash, wrong results, etc).
+
@deftypefun mp_exp_t mpfr_get_emin (void)
@deftypefunx mp_exp_t mpfr_get_emax (void)
Return the (current) smallest and largest exponents allowed for a
@@ -1003,6 +1007,8 @@ the absolute value of @var{op}, and a negative value otherwise.
@end deftypefun
@deftypefun int mpfr_mul_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_2ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_2si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mp_rnd_t @var{rnd})
@ifinfo
Set @var{rop} to @var{op1} times 2 raised to @var{op2}
@end ifinfo
@@ -1015,9 +1021,13 @@ rounded to the direction @var{rnd}. Just increases the exponent by @var{op2}
when @var{rop} and @var{op1} are identical.
Return zero when @var{rop}=@var{op1}, a positive value when @var{rop}>@var{op1},
and a negative value when @var{rop}<@var{op1}.
+Note: The @code{mpfr_mul_2exp} function is defined for compatibility reasons;
+you should use @code{mpfr_mul_2ui} (or @code{mpfr_mul_2si}) instead.
@end deftypefun
@deftypefun int mpfr_div_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_2ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_2si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mp_rnd_t @var{rnd})
@ifinfo
Set @var{rop} to @var{op1} divided by 2 raised to @var{op2}
@end ifinfo
@@ -1030,6 +1040,8 @@ rounded to the direction @var{rnd}. Just decreases the exponent by @var{op2}
when @var{rop} and @var{op1} are identical.
Return zero when @var{rop}=@var{op1}, a positive value when @var{rop}>@var{op1},
and a negative value when @var{rop}<@var{op1}.
+Note: The @code{mpfr_div_2exp} function is defined for compatibility reasons;
+you should use @code{mpfr_div_2ui} (or @code{mpfr_div_2si}) instead.
@end deftypefun
@node Float Comparison, I/O of Floats, Float Arithmetic, Floating-point Functions
diff --git a/mpfr/rnd_mode.c b/mpfr/rnd_mode.c
index eb9402acf..c2b369b58 100644
--- a/mpfr/rnd_mode.c
+++ b/mpfr/rnd_mode.c
@@ -19,7 +19,7 @@ along with the MPFR Library; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-#ifdef HAVE_FENV_H
+#ifdef HAVE_FESETROUND
#include <stdio.h>
#include <stdlib.h>
#include <fenv.h>
diff --git a/mpfr/tests/Makefile.in b/mpfr/tests/Makefile.in
index 78a100bcc..e15ccd6f2 100644
--- a/mpfr/tests/Makefile.in
+++ b/mpfr/tests/Makefile.in
@@ -84,7 +84,6 @@ BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
-CFLAGS_IEEE_WITH_INEXACT = @CFLAGS_IEEE_WITH_INEXACT@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
diff --git a/mpfr/tests/tadd.c b/mpfr/tests/tadd.c
index 546483127..25d35b4fd 100644
--- a/mpfr/tests/tadd.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
/* 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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
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/mpfr/tests/tadd_ui.c b/mpfr/tests/tadd_ui.c
index 2321d2586..45c9d3eff 100644
--- a/mpfr/tests/tadd_ui.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
double x; unsigned long y, N; int i,rnd_mode,rnd;
mpfr_test_init ();
diff --git a/mpfr/tests/tagm.c b/mpfr/tests/tagm.c
index bacb15b4b..3e80b1491 100644
--- a/mpfr/tests/tagm.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
mpfr_set_machine_rnd_mode(rnd_mode);
#endif
diff --git a/mpfr/tests/tdiv.c b/mpfr/tests/tdiv.c
index c07c2a3eb..8438bbeb6 100644
--- a/mpfr/tests/tdiv.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
N = (argc>1) ? atoi(argv[1]) : 100000;
SEED_RAND (time(NULL));
for (i=0;i<N;i++)
diff --git a/mpfr/tests/tdiv_ui.c b/mpfr/tests/tdiv_ui.c
index addc350ab..3b6076f3d 100644
--- a/mpfr/tests/tdiv_ui.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
int i;
unsigned long u;
double d;
diff --git a/mpfr/tests/texp.c b/mpfr/tests/texp.c
index 333ff1904..2193a2dcb 100644
--- a/mpfr/tests/texp.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
SEED_RAND (time(NULL));
N = (argc==1) ? 0 : atoi(argv[1]);
lo = (argc>=3) ? atof(argv[2]) : -7.083964185e2;
diff --git a/mpfr/tests/tget_d.c b/mpfr/tests/tget_d.c
index 754fc74cb..c98056d8d 100644
--- a/mpfr/tests/tget_d.c
+++ b/mpfr/tests/tget_d.c
@@ -61,7 +61,7 @@ int
main (void)
{
-#ifdef HAVE_FENV_H
+#ifdef HAVE_FESETROUND
mpfr_t half, x, y;
mp_rnd_t rnd_mode;
diff --git a/mpfr/tests/tget_str.c b/mpfr/tests/tget_str.c
index 7eceb19c0..ea49c4069 100644
--- a/mpfr/tests/tget_str.c
+++ b/mpfr/tests/tget_str.c
@@ -26,7 +26,7 @@ MA 02111-1307, USA. */
#include <time.h>
#include "gmp.h"
#include "mpfr.h"
-#ifdef HAVE_FENV_H
+#ifdef HAVE_FESETROUND
#include "mpfr-test.h"
#endif
@@ -105,7 +105,7 @@ check_small (void)
int
main (int argc, char *argv[])
{
-#ifdef HAVE_FENV_H
+#ifdef HAVE_FESETROUND
int i;
double d;
diff --git a/mpfr/tests/tlog.c b/mpfr/tests/tlog.c
index 3a0dcd1c4..55fdd70bc 100644
--- a/mpfr/tests/tlog.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
mpfr_set_machine_rnd_mode(rnd_mode);
#endif
if (ck==0 && res1==0.0) res1=log(a);
diff --git a/mpfr/tests/tmul.c b/mpfr/tests/tmul.c
index 7b572a7f5..acd2cd393 100644
--- a/mpfr/tests/tmul.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
SEED_RAND (time(NULL));
prec = (argc<2) ? 53 : atoi(argv[1]);
rnd_mode = (argc<3) ? -1 : atoi(argv[2]);
diff --git a/mpfr/tests/tset_q.c b/mpfr/tests/tset_q.c
index 57497843f..b26d39119 100644
--- a/mpfr/tests/tset_q.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
long int i, n;
unsigned long int d;
double y;
diff --git a/mpfr/tests/tsqrt.c b/mpfr/tests/tsqrt.c
index bf6f1f5e5..5cd5e4ffa 100644
--- a/mpfr/tests/tsqrt.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
int i;
mpfr_test_init ();
diff --git a/mpfr/tests/tsqrt_ui.c b/mpfr/tests/tsqrt_ui.c
index f3c7efabf..aab744847 100644
--- a/mpfr/tests/tsqrt_ui.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
int i;
unsigned long a;
diff --git a/mpfr/tests/tsub_ui.c b/mpfr/tests/tsub_ui.c
index eccc97dc4..da1e222bb 100644
--- a/mpfr/tests/tsub_ui.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
double x; unsigned long y, N; int i,rnd_mode,rnd;
mpfr_test_init ();
diff --git a/mpfr/tests/tui_div.c b/mpfr/tests/tui_div.c
index 770faed5b..9f0d99724 100644
--- a/mpfr/tests/tui_div.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
double x;
unsigned long y, N;
int i, rnd_mode, rnd;
diff --git a/mpfr/tests/tui_sub.c b/mpfr/tests/tui_sub.c
index 2d34dc56d..bfbdd60d2 100644
--- a/mpfr/tests/tui_sub.c
+++ b/mpfr/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_H
+#ifdef HAVE_FESETROUND
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_H
+#ifdef HAVE_FESETROUND
double x;
unsigned long y, N;
int i, rnd_mode, rnd;