Fix build for platforms w/o fenv.h.
Remove some bogus #ifdef __vax__ (and add a few, hopefully non-bogus, new ones).
This commit is contained in:
parent
bbb72bf83b
commit
5e5099dfc8
|
@ -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 @@ AFT_LIBM_TEST(acos_nan, "Test acos/acosf(x) == NaN, x = NaN, +/-Inf, ![-1..1]")
|
|||
-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_inrange, "Test acos/acosf(x) for some valid values")
|
|||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue