Module Name:    src
Committed By:   martin
Date:           Mon Mar  3 10:38:36 UTC 2014

Modified Files:
        src/tests/lib/libm: t_acos.c

Log Message:
Fix build for platforms w/o fenv.h.
Remove some bogus #ifdef __vax__ (and add a few, hopefully non-bogus,
new ones).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libm/t_acos.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libm/t_acos.c
diff -u src/tests/lib/libm/t_acos.c:1.6 src/tests/lib/libm/t_acos.c:1.7
--- src/tests/lib/libm/t_acos.c:1.6	Sun Mar  2 22:40:45 2014
+++ src/tests/lib/libm/t_acos.c	Mon Mar  3 10:38:36 2014
@@ -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
 	    -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/a
 
 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)

Reply via email to