stdlib: Fix stdbit.h with -Wconversion for clang
[glibc.git] / sysdeps / generic / math-tests.h
blob53194ae9e6063f86c37856ea27aa6d604db334d2
1 /* Configuration for math tests. Generic version.
2 Copyright (C) 2013-2024 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 <https://www.gnu.org/licenses/>. */
19 #include <bits/floatn.h>
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
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 #define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
44 #include <math-tests-exceptions.h>
45 #include <math-tests-rounding.h>
46 #include <math-tests-snan.h>
47 #include <math-tests-snan-cast.h>
48 #include <math-tests-snan-payload.h>
49 #include <math-tests-trap.h>
50 #include <math-tests-trap-force.h>