]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/generic/math-tests.h
1 /* Configuration for math tests. Generic version.
2 Copyright (C) 2013-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <bits/floatn.h>
21 /* Expand the appropriate macro for whether to enable tests for a
23 #if __HAVE_DISTINCT_FLOAT128
24 # define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
25 (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
26 : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
27 : __builtin_types_compatible_p (TYPE, _Float128) ? PREFIX ## float128 ARGS \
28 : PREFIX ## long_double ARGS)
30 # define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
31 (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
32 : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
33 : PREFIX ## long_double ARGS)
36 /* Return nonzero value if to run tests involving sNaN values for X. */
37 #define SNAN_TESTS(x) MATH_TESTS_TG (SNAN_TESTS_, , x)
39 #define ROUNDING_TESTS(TYPE, MODE) \
40 MATH_TESTS_TG (ROUNDING_TESTS_, (MODE), TYPE)
42 /* Indicate whether to run tests of floating-point exceptions for a
43 given floating-point type, given that the exception macros are
44 defined. All are run unless overridden. */
45 #ifndef EXCEPTION_TESTS_float
46 # define EXCEPTION_TESTS_float 1
48 #ifndef EXCEPTION_TESTS_double
49 # define EXCEPTION_TESTS_double 1
51 #ifndef EXCEPTION_TESTS_long_double
52 # define EXCEPTION_TESTS_long_double 1
54 #ifndef EXCEPTION_TESTS_float128
55 # define EXCEPTION_TESTS_float128 1
58 #define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
60 /* Indicate whether the given exception trap(s) can be enabled
61 in feenableexcept. If non-zero, the traps are always supported.
62 If zero, traps may or may not be supported depending on the
63 target (this can be determined by checking the return value
64 of feenableexcept). This enables skipping of tests which use
65 traps. By default traps are supported unless overridden. */
66 #ifndef EXCEPTION_ENABLE_SUPPORTED
67 # define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) \
68 (EXCEPTION_TESTS_float || EXCEPTION_TESTS_double)
71 /* Indicate whether exception traps, if enabled, occur whenever an
72 exception flag is set explicitly, so it is not possible to set flag
73 bits with traps enabled without causing traps to be taken. If
74 traps cannot be enabled, the value of this macro does not
76 #ifndef EXCEPTION_SET_FORCES_TRAP
77 # define EXCEPTION_SET_FORCES_TRAP 0
80 #include <math-tests-rounding.h>
81 #include <math-tests-snan.h>
82 #include <math-tests-snan-cast.h>
83 #include <math-tests-snan-payload.h>