about summary refs log tree commit diff
path: root/math/test-fenv.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-05-17 08:49:19 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-05-17 08:50:41 -0400
commit0af797def371ceb4f05586d7bcd25841653d2082 (patch)
tree3aa5591836c95fba6b694fb45c1421bf0025de91 /math/test-fenv.c
parente39745ffa030f685fbba13534a3023d52a27ead8 (diff)
downloadglibc-0af797def371ceb4f05586d7bcd25841653d2082.tar.gz
glibc-0af797def371ceb4f05586d7bcd25841653d2082.tar.xz
glibc-0af797def371ceb4f05586d7bcd25841653d2082.zip
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.
Diffstat (limited to 'math/test-fenv.c')
-rw-r--r--math/test-fenv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/math/test-fenv.c b/math/test-fenv.c
index 39c7c33459..19e5415f73 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)
     {