Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / generic / math-tests.h
blobb92623f7cd408ffb343ef503e756ff46057e62f8
1 /* Configuration for math tests. Generic version.
2 Copyright (C) 2013-2015 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 /* 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
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)
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
44 /* Indicate whether to run tests involving a given rounding mode for a
45 given floating-point type, given that fesetround succeeds for that
46 mode. All are run if fesetround succeeds unless overridden. */
47 #ifndef ROUNDING_TESTS_float
48 # define ROUNDING_TESTS_float(MODE) 1
49 #endif
50 #ifndef ROUNDING_TESTS_double
51 # define ROUNDING_TESTS_double(MODE) 1
52 #endif
53 #ifndef ROUNDING_TESTS_long_double
54 # define ROUNDING_TESTS_long_double(MODE) 1
55 #endif
57 #define ROUNDING_TESTS(TYPE, MODE) \
58 (sizeof (TYPE) == sizeof (float) ? ROUNDING_TESTS_float (MODE) \
59 : sizeof (TYPE) == sizeof (double) ? ROUNDING_TESTS_double (MODE) \
60 : ROUNDING_TESTS_long_double (MODE))
62 /* Indicate whether to run tests of floating-point exceptions for a
63 given floating-point type, given that the exception macros are
64 defined. All are run unless overridden. */
65 #ifndef EXCEPTION_TESTS_float
66 # define EXCEPTION_TESTS_float 1
67 #endif
68 #ifndef EXCEPTION_TESTS_double
69 # define EXCEPTION_TESTS_double 1
70 #endif
71 #ifndef EXCEPTION_TESTS_long_double
72 # define EXCEPTION_TESTS_long_double 1
73 #endif
75 #define EXCEPTION_TESTS(TYPE) \
76 (sizeof (TYPE) == sizeof (float) ? EXCEPTION_TESTS_float \
77 : sizeof (TYPE) == sizeof (double) ? EXCEPTION_TESTS_double \
78 : EXCEPTION_TESTS_long_double)
80 /* Indicate whether the given exception trap(s) can be enabled
81 in feenableexcept. If non-zero, the traps are always supported.
82 If zero, traps may or may not be supported depending on the
83 target (this can be determined by checking the return value
84 of feenableexcept). This enables skipping of tests which use
85 traps. By default traps are supported unless overridden. */
86 #ifndef EXCEPTION_ENABLE_SUPPORTED
87 # define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) \
88 (EXCEPTION_TESTS_float || EXCEPTION_TESTS_double)
89 #endif