summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-02-06 09:10:34 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-02-06 09:10:34 +0000
commit7e408afc43bc53101409ebfc94d1f00fe0723f77 (patch)
treee28c48e44a5ac6128b8be9d59cfc2fd1c712f2a9
parenta586834d788017fc9d4106dd27c7c9bfb77c5f86 (diff)
downloadmpfr-7e408afc43bc53101409ebfc94d1f00fe0723f77.tar.gz
[tests] Use MPFR_DBL_* macros when necessary.
(merged changeset r13446 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13449 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tcmp_d.c3
-rw-r--r--tests/tcmp_ld.c3
-rw-r--r--tests/td_div.c9
-rw-r--r--tests/tget_flt.c5
-rw-r--r--tests/tset_float128.c15
5 files changed, 19 insertions, 16 deletions
diff --git a/tests/tcmp_d.c b/tests/tcmp_d.c
index 442ee17ad..8dd62b6c9 100644
--- a/tests/tcmp_d.c
+++ b/tests/tcmp_d.c
@@ -21,6 +21,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "mpfr-test.h"
+#include "ieee_floats.h"
int
main (void)
@@ -86,7 +87,7 @@ main (void)
int c;
mpfr_clear_flags ();
- c = mpfr_cmp_d (x, DBL_NAN);
+ c = mpfr_cmp_d (x, MPFR_DBL_NAN);
if (c != 0 || __gmpfr_flags != MPFR_FLAGS_ERANGE)
{
printf ("ERROR for NAN (1)\n");
diff --git a/tests/tcmp_ld.c b/tests/tcmp_ld.c
index 22ae139c3..a33059669 100644
--- a/tests/tcmp_ld.c
+++ b/tests/tcmp_ld.c
@@ -23,6 +23,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include <float.h>
#include "mpfr-test.h"
+#include "ieee_floats.h"
int
main (void)
@@ -88,7 +89,7 @@ main (void)
int c;
mpfr_clear_flags ();
- c = mpfr_cmp_ld (x, DBL_NAN);
+ c = mpfr_cmp_ld (x, MPFR_DBL_NAN);
if (c != 0 || __gmpfr_flags != MPFR_FLAGS_ERANGE)
{
printf ("ERROR for NAN (1)\n");
diff --git a/tests/td_div.c b/tests/td_div.c
index fc9b61939..23fb264eb 100644
--- a/tests/td_div.c
+++ b/tests/td_div.c
@@ -23,6 +23,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include <float.h>
#include "mpfr-test.h"
+#include "ieee_floats.h"
static void
check_nans (void)
@@ -102,7 +103,7 @@ check_nans (void)
/* +inf / 0 == +inf */
mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, DBL_POS_INF, x, MPFR_RNDN);
+ inexact = mpfr_d_div (y, MPFR_DBL_INFP, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -111,7 +112,7 @@ check_nans (void)
/* -inf / 0 == -inf */
mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, DBL_NEG_INF, x, MPFR_RNDN);
+ inexact = mpfr_d_div (y, MPFR_DBL_INFM, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -121,7 +122,7 @@ check_nans (void)
mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_neg (x, x, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, DBL_POS_INF, x, MPFR_RNDN);
+ inexact = mpfr_d_div (y, MPFR_DBL_INFP, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
@@ -131,7 +132,7 @@ check_nans (void)
mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_neg (x, x, MPFR_RNDN);
mpfr_clear_flags ();
- inexact = mpfr_d_div (y, DBL_NEG_INF, x, MPFR_RNDN);
+ inexact = mpfr_d_div (y, MPFR_DBL_INFM, x, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
MPFR_ASSERTN (__gmpfr_flags == 0);
MPFR_ASSERTN (mpfr_inf_p (y));
diff --git a/tests/tget_flt.c b/tests/tget_flt.c
index 1983af387..2e22bd238 100644
--- a/tests/tget_flt.c
+++ b/tests/tget_flt.c
@@ -23,6 +23,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include <float.h> /* for FLT_MIN */
#include "mpfr-test.h"
+#include "ieee_floats.h"
/* return non-zero iff f == g, and if both are zero check the sign */
static int
@@ -59,9 +60,7 @@ main (void)
tests_start_mpfr ();
#if !defined(MPFR_ERRDIVZERO)
- /* The definition of DBL_POS_INF involves a division by 0. This makes
- "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */
- infp = (float) DBL_POS_INF;
+ infp = (float) MPFR_DBL_INFP;
if (infp * 0.5 != infp)
{
fprintf (stderr, "Error, FLT_MAX + FLT_MAX does not yield INFP\n");
diff --git a/tests/tset_float128.c b/tests/tset_float128.c
index 01580cb2a..3a13a2e58 100644
--- a/tests/tset_float128.c
+++ b/tests/tset_float128.c
@@ -28,6 +28,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#ifdef MPFR_WANT_FLOAT128
#include "mpfr-test.h"
+#include "ieee_floats.h"
static void
check_special (void)
@@ -39,7 +40,7 @@ check_special (void)
#if !defined(MPFR_ERRDIVZERO)
/* check NaN */
- f = 0.0 / 0.0;
+ f = MPFR_DBL_NAN;
mpfr_set_float128 (x, f, MPFR_RNDN);
if (! mpfr_nan_p (x))
{
@@ -55,7 +56,7 @@ check_special (void)
}
/* check +Inf */
- f = 1.0 / 0.0;
+ f = MPFR_DBL_INFP;
mpfr_set_float128 (x, f, MPFR_RNDN);
if (! mpfr_inf_p (x) || MPFR_IS_NEG (x))
{
@@ -63,14 +64,14 @@ check_special (void)
exit (1);
}
f = mpfr_get_float128 (x, MPFR_RNDN);
- if (f != (1.0 / 0.0))
+ if (f != MPFR_DBL_INFP)
{
printf ("Error in mpfr_get_float128(+Inf)\n");
exit (1);
}
/* check -Inf */
- f = -1.0 / 0.0;
+ f = MPFR_DBL_INFM;
mpfr_set_float128 (x, f, MPFR_RNDN);
if (! mpfr_inf_p (x) || MPFR_IS_POS (x))
{
@@ -78,7 +79,7 @@ check_special (void)
exit (1);
}
f = mpfr_get_float128 (x, MPFR_RNDN);
- if (f != (-1.0 / 0.0))
+ if (f != MPFR_DBL_INFM)
{
printf ("Error in mpfr_get_float128(-Inf)\n");
exit (1);
@@ -100,7 +101,7 @@ check_special (void)
exit (1);
}
#if !defined(MPFR_ERRDIVZERO) && defined(HAVE_SIGNEDZ)
- if (1 / f != 1 / 0.0) /* check the sign */
+ if (1 / f != MPFR_DBL_INFP) /* check the sign */
{
printf ("Error in mpfr_get_float128(+0.0)\n");
exit (1);
@@ -129,7 +130,7 @@ check_special (void)
exit (1);
}
#if !defined(MPFR_ERRDIVZERO) && defined(HAVE_SIGNEDZ)
- if (1 / f != 1 / -0.0) /* check the sign */
+ if (1 / f != MPFR_DBL_INFM) /* check the sign */
{
printf ("Error in mpfr_get_float128(-0.0)\n");
exit (1);