]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/generic/math-tests.h
Move ROUNDING_TESTS_* out of math-tests.h.
[thirdparty/glibc.git] / 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.
4
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.
9
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.
14
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/>. */
18
19 #include <bits/floatn.h>
20
21 /* Expand the appropriate macro for whether to enable tests for a
22 given type. */
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)
29 # else
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)
34 #endif
35
36 /* Return nonzero value if to run tests involving sNaN values for X. */
37 #define SNAN_TESTS(x) MATH_TESTS_TG (SNAN_TESTS_, , x)
38
39 #define ROUNDING_TESTS(TYPE, MODE) \
40 MATH_TESTS_TG (ROUNDING_TESTS_, (MODE), TYPE)
41
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
47 #endif
48 #ifndef EXCEPTION_TESTS_double
49 # define EXCEPTION_TESTS_double 1
50 #endif
51 #ifndef EXCEPTION_TESTS_long_double
52 # define EXCEPTION_TESTS_long_double 1
53 #endif
54 #ifndef EXCEPTION_TESTS_float128
55 # define EXCEPTION_TESTS_float128 1
56 #endif
57
58 #define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
59
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)
69 #endif
70
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
75 matter. */
76 #ifndef EXCEPTION_SET_FORCES_TRAP
77 # define EXCEPTION_SET_FORCES_TRAP 0
78 #endif
79
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>