]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/simd/tests/math_1arg.cc
1 // test only floattypes
2 // Copyright (C) 2020 Free Software Foundation, Inc.
4 // This file is part of the GNU ISO C++ Library. This library is free
5 // software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the
7 // Free Software Foundation; either version 3, or (at your option)
10 // This 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
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this library; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 #include "bits/verify.h"
20 #include "bits/test_values.h"
26 vir::test::setFuzzyness
<float>(0);
27 vir::test::setFuzzyness
<double>(0);
29 using T
= typename
V::value_type
;
30 constexpr T inf
= std::__infinity_v
<T
>;
31 constexpr T nan
= std::__quiet_NaN_v
<T
>;
32 constexpr T denorm_min
= std::__denorm_min_v
<T
>;
33 constexpr T norm_min
= std::__norm_min_v
<T
>;
34 constexpr T max
= std::__finite_max_v
<T
>;
35 #if defined __LONG_DOUBLE_IBM128__
36 // On POWER with IBM128 long double, 1+eps and 2-eps is not a constant
37 // expression. Until this is fixed, just use const instead of constexpr.
38 // (error: '(1.0e+0l + 4.94065645841246544176568792868221e-324l)' is not a
39 // constant expression)
40 const T after_one
= 1 + std::__epsilon_v
<T
>;
41 const T before_one
= (2 - std::__epsilon_v
<T
>) / 2;
43 constexpr T after_one
= 1 + std::__epsilon_v
<T
>;
44 constexpr T before_one
= (2 - std::__epsilon_v
<T
>) / 2;
46 const std::initializer_list
<T
>
63 -0x1.fffffffffffffp52
,
65 -0x1.ffffffffffffep52
,
67 -0x1.ffffffffffffdp52
,
90 test_values
<V
>(input_values
, {10000}, MAKE_TESTER(erf
), MAKE_TESTER(erfc
),
91 MAKE_TESTER(tgamma
), MAKE_TESTER(lgamma
), MAKE_TESTER(ceil
),
92 MAKE_TESTER(floor
), MAKE_TESTER(trunc
), MAKE_TESTER(round
),
93 MAKE_TESTER(lround
), MAKE_TESTER(llround
),
94 MAKE_TESTER(nearbyint
), MAKE_TESTER(rint
), MAKE_TESTER(lrint
),
95 MAKE_TESTER(llrint
), MAKE_TESTER(ilogb
));
97 // sqrt(x) on x87 is precise in 80 bits, but the subsequent rounding can be
98 // wrong (up to 1 ULP)
99 #if __FLT_EVAL_METHOD__ == 1
100 vir::test::setFuzzyness
<float>(1);
101 vir::test::setFuzzyness
<double>(0);
102 #elif __FLT_EVAL_METHOD__ == 2
103 vir::test::setFuzzyness
<float>(1);
104 vir::test::setFuzzyness
<double>(1);
106 test_values
<V
>(input_values
, {10000}, MAKE_TESTER(sqrt
));