From 0af797def371ceb4f05586d7bcd25841653d2082 Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Thu, 17 May 2012 08:49:19 -0400 Subject: math: support platforms with limited FP rounding or exception support For some tests, just claim that fetestexcept() always returns true, so the rest of the test can be compiled. For libm-test, provide known bogus values for unsupported rounding modes, so fesetround() will return failure. Elsewhere, just add some #ifdefs to avoid code that uses particular FP exceptions if the exceptions aren't supported. --- math/test-fenv.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'math/test-fenv.c') diff --git a/math/test-fenv.c b/math/test-fenv.c index 39c7c33..19e5415 100644 --- a/math/test-fenv.c +++ b/math/test-fenv.c @@ -664,9 +664,11 @@ feholdexcept_tests (void) } #endif test_exceptions ("feholdexcept_tests 0 test", NO_EXC, 0); +#ifdef FE_INVALID feraiseexcept (FE_INVALID); test_exceptions ("feholdexcept_tests FE_INVALID test", INVALID_EXC, 0); +#endif res = feupdateenv (&saved); if (res != 0) { @@ -684,7 +686,9 @@ feholdexcept_tests (void) test_exceptions ("feholdexcept_tests FE_DIVBYZERO|FE_INVALID test", DIVBYZERO_EXC | INVALID_EXC, 0); feclearexcept (FE_ALL_EXCEPT); +#ifdef FE_INVALID feraiseexcept (FE_INVALID); +#endif #if defined FE_TONEAREST && defined FE_UPWARD res = fesetround (FE_UPWARD); if (res != 0) @@ -708,9 +712,11 @@ feholdexcept_tests (void) } #endif test_exceptions ("feholdexcept_tests 0 2nd test", NO_EXC, 0); +#ifdef FE_INEXACT feraiseexcept (FE_INEXACT); test_exceptions ("feholdexcept_tests FE_INEXACT test", INEXACT_EXC, 0); +#endif res = feupdateenv (&saved2); if (res != 0) { -- cgit v1.1