Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libm Fix build for platforms w/o fenv.h.
details: https://anonhg.NetBSD.org/src/rev/fe76abb12766
branches: trunk
changeset: 327263:fe76abb12766
user: martin <martin%NetBSD.org@localhost>
date: Mon Mar 03 10:38:36 2014 +0000
description:
Fix build for platforms w/o fenv.h.
Remove some bogus #ifdef __vax__ (and add a few, hopefully non-bogus,
new ones).
diffstat:
tests/lib/libm/t_acos.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diffs (78 lines):
diff -r 2bd554d80e2d -r fe76abb12766 tests/lib/libm/t_acos.c
--- a/tests/lib/libm/t_acos.c Mon Mar 03 09:10:46 2014 +0000
+++ b/tests/lib/libm/t_acos.c Mon Mar 03 10:38:36 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_acos.c,v 1.6 2014/03/02 22:40:45 dsl Exp $ */
+/* $NetBSD: t_acos.c,v 1.7 2014/03/03 10:38:36 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,12 +31,16 @@
#include <atf-c.h>
#include <math.h>
+
+#ifdef HAVE_FENV_H
#include <fenv.h>
+#endif
/*
* Check result of fn(arg) is correct within the bounds.
* Should be ok to do the checks using 'double' for 'float' functions.
*/
+#ifdef HAVE_FENV_H
#define T_LIBM_CHECK(subtest, fn, arg, expect, epsilon) do { \
double r = fn(arg); \
double e = fabs(r - expect); \
@@ -45,6 +49,16 @@
"subtest %zu: " #fn "(%g) is %g not %g (error %g > %g), roundmode %x", \
subtest, arg, r, expect, e, epsilon, fegetround()); \
} while (0)
+#else
+#define T_LIBM_CHECK(subtest, fn, arg, expect, epsilon) do { \
+ double r = fn(arg); \
+ double e = fabs(r - expect); \
+ if (e > epsilon) \
+ atf_tc_fail_nonfatal( \
+ "subtest %zu: " #fn "(%g) is %g not %g (error %g > %g)", \
+ subtest, arg, r, expect, e, epsilon); \
+ } while (0)
+#endif
/* Check that the result of fn(arg) is NaN */
#ifndef __vax__
@@ -74,9 +88,11 @@
-1.000000001, 1.000000001,
-1.0000001, 1.0000001,
-1.1, 1.1,
+#ifndef __vax__
0.0L / 0.0L, /* NAN */
-1.0L / 0.0L, /* -Inf */
+1.0L / 0.0L, /* +Inf */
+#endif
};
size_t i;
@@ -120,22 +136,18 @@
AFT_LIBM_TEST(acos_one_pos, "Test acos(1.0) == +0.0")
{
-#ifndef __vax__
const double y = acos(1.0);
if (fabs(y) > 0.0 || signbit(y) != 0)
atf_tc_fail_nonfatal("acos(1.0) != +0.0");
-#endif
}
AFT_LIBM_TEST(acosf_one_pos, "Test acosf(1.0) == +0.0")
{
-#ifndef __vax__
const float y = acosf(1.0);
if (fabsf(y) > 0.0 || signbit(y) != 0)
atf_tc_fail_nonfatal("acosf(1.0) != +0.0");
-#endif
}
ATF_TP_ADD_TCS(tp)
Home |
Main Index |
Thread Index |
Old Index