]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/generic/math-tests.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / generic / math-tests.h
1 /* Configuration for math tests. Generic version.
2 Copyright (C) 2013-2017 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 /* Indicate whether to run tests involving sNaN values for the float, double,
20 and long double C data types, respectively. All are run unless
21 overridden. */
22 #ifndef SNAN_TESTS_float
23 # define SNAN_TESTS_float 1
24 #endif
25 #ifndef SNAN_TESTS_double
26 # define SNAN_TESTS_double 1
27 #endif
28 #ifndef SNAN_TESTS_long_double
29 # define SNAN_TESTS_long_double 1
30 #endif
31
32 /* Return nonzero value if to run tests involving sNaN values for X. */
33 #define SNAN_TESTS(x) \
34 (sizeof (x) == sizeof (float) ? SNAN_TESTS_float \
35 : sizeof (x) == sizeof (double) ? SNAN_TESTS_double \
36 : SNAN_TESTS_long_double)
37
38 /* Indicate whether to run tests involving type casts of sNaN values. These
39 are run unless overridden. */
40 #ifndef SNAN_TESTS_TYPE_CAST
41 # define SNAN_TESTS_TYPE_CAST 1
42 #endif
43
44 /* Indicate whether operations on signaling NaNs preserve the payload
45 (if possible; it is not possible with a zero payload if the high
46 bit is set for signaling NaNs) when generating a quiet NaN, and
47 this should be tested. */
48 #ifndef SNAN_TESTS_PRESERVE_PAYLOAD
49 # define SNAN_TESTS_PRESERVE_PAYLOAD 1
50 #endif
51
52 /* Indicate whether to run tests involving a given rounding mode for a
53 given floating-point type, given that fesetround succeeds for that
54 mode. All are run if fesetround succeeds unless overridden. */
55 #ifndef ROUNDING_TESTS_float
56 # define ROUNDING_TESTS_float(MODE) 1
57 #endif
58 #ifndef ROUNDING_TESTS_double
59 # define ROUNDING_TESTS_double(MODE) 1
60 #endif
61 #ifndef ROUNDING_TESTS_long_double
62 # define ROUNDING_TESTS_long_double(MODE) 1
63 #endif
64
65 #define ROUNDING_TESTS(TYPE, MODE) \
66 (sizeof (TYPE) == sizeof (float) ? ROUNDING_TESTS_float (MODE) \
67 : sizeof (TYPE) == sizeof (double) ? ROUNDING_TESTS_double (MODE) \
68 : ROUNDING_TESTS_long_double (MODE))
69
70 /* Indicate whether to run tests of floating-point exceptions for a
71 given floating-point type, given that the exception macros are
72 defined. All are run unless overridden. */
73 #ifndef EXCEPTION_TESTS_float
74 # define EXCEPTION_TESTS_float 1
75 #endif
76 #ifndef EXCEPTION_TESTS_double
77 # define EXCEPTION_TESTS_double 1
78 #endif
79 #ifndef EXCEPTION_TESTS_long_double
80 # define EXCEPTION_TESTS_long_double 1
81 #endif
82
83 #define EXCEPTION_TESTS(TYPE) \
84 (sizeof (TYPE) == sizeof (float) ? EXCEPTION_TESTS_float \
85 : sizeof (TYPE) == sizeof (double) ? EXCEPTION_TESTS_double \
86 : EXCEPTION_TESTS_long_double)
87
88 /* Indicate whether the given exception trap(s) can be enabled
89 in feenableexcept. If non-zero, the traps are always supported.
90 If zero, traps may or may not be supported depending on the
91 target (this can be determined by checking the return value
92 of feenableexcept). This enables skipping of tests which use
93 traps. By default traps are supported unless overridden. */
94 #ifndef EXCEPTION_ENABLE_SUPPORTED
95 # define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) \
96 (EXCEPTION_TESTS_float || EXCEPTION_TESTS_double)
97 #endif
98
99 /* Indicate whether exception traps, if enabled, occur whenever an
100 exception flag is set explicitly, so it is not possible to set flag
101 bits with traps enabled without causing traps to be taken. If
102 traps cannot be enabled, the value of this macro does not
103 matter. */
104 #ifndef EXCEPTION_SET_FORCES_TRAP
105 # define EXCEPTION_SET_FORCES_TRAP 0
106 #endif