math-tests.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Configuration for math tests. Generic version.
  2. Copyright (C) 2013-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <bits/floatn.h>
  16. /* Expand the appropriate macro for whether to enable tests for a
  17. given type. */
  18. #if __HAVE_DISTINCT_FLOAT128
  19. # define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
  20. (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
  21. : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
  22. : __builtin_types_compatible_p (TYPE, _Float128) ? PREFIX ## float128 ARGS \
  23. : PREFIX ## long_double ARGS)
  24. # else
  25. # define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
  26. (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
  27. : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
  28. : PREFIX ## long_double ARGS)
  29. #endif
  30. /* Return nonzero value if to run tests involving sNaN values for X. */
  31. #define SNAN_TESTS(x) MATH_TESTS_TG (SNAN_TESTS_, , x)
  32. #define ROUNDING_TESTS(TYPE, MODE) \
  33. MATH_TESTS_TG (ROUNDING_TESTS_, (MODE), TYPE)
  34. #define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
  35. #include <math-tests-exceptions.h>
  36. #include <math-tests-rounding.h>
  37. #include <math-tests-snan.h>
  38. #include <math-tests-snan-cast.h>
  39. #include <math-tests-snan-payload.h>
  40. #include <math-tests-trap.h>
  41. #include <math-tests-trap-force.h>