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-misc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'math/test-misc.c') diff --git a/math/test-misc.c b/math/test-misc.c index c0fe5f7a18..55da359ce5 100644 --- a/math/test-misc.c +++ b/math/test-misc.c @@ -1186,12 +1186,14 @@ main (void) (void) &f2; feclearexcept (FE_ALL_EXCEPT); f2 += f1; +#if defined(FE_OVERFLOW) && defined(FE_INEXACT) int fe = fetestexcept (FE_ALL_EXCEPT); if (fe != (FE_OVERFLOW | FE_INEXACT)) { printf ("float overflow test failed: %x\n", fe); result = 1; } +#endif volatile double d1 = DBL_MAX; volatile double d2 = DBL_MAX / 2; @@ -1199,12 +1201,14 @@ main (void) (void) &d2; feclearexcept (FE_ALL_EXCEPT); d2 += d1; +#if defined(FE_OVERFLOW) && defined(FE_INEXACT) fe = fetestexcept (FE_ALL_EXCEPT); if (fe != (FE_OVERFLOW | FE_INEXACT)) { printf ("double overflow test failed: %x\n", fe); result = 1; } +#endif #ifndef NO_LONG_DOUBLE volatile long double ld1 = LDBL_MAX; @@ -1213,12 +1217,14 @@ main (void) (void) &ld2; feclearexcept (FE_ALL_EXCEPT); ld2 += ld1; +# if defined(FE_OVERFLOW) && defined(FE_INEXACT) fe = fetestexcept (FE_ALL_EXCEPT); if (fe != (FE_OVERFLOW | FE_INEXACT)) { printf ("long double overflow test failed: %x\n", fe); result = 1; } +# endif #endif #if !defined NO_LONG_DOUBLE && LDBL_MANT_DIG == 113 -- cgit 1.4.1