]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / experimental / simd / tests / logarithm.cc
1 // Copyright (C) 2020-2022 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8 //
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // only: float|double|ldouble * * *
19 // expensive: * [1-9] * *
20 #include "bits/verify.h"
21 #include "bits/metahelpers.h"
22 #include "bits/mathreference.h"
23 #include "bits/test_values.h"
24
25 template <typename V>
26 void
27 test()
28 {
29 vir::test::setFuzzyness<float>(1);
30 vir::test::setFuzzyness<double>(1);
31
32 using T = typename V::value_type;
33 constexpr T nan = std::__quiet_NaN_v<T>;
34 constexpr T inf = std::__infinity_v<T>;
35 constexpr T denorm_min = std::__denorm_min_v<T>;
36 constexpr T norm_min = std::__norm_min_v<T>;
37 constexpr T min = std::__finite_min_v<T>;
38 constexpr T max = std::__finite_max_v<T>;
39 test_values<V>({1,
40 2,
41 4,
42 8,
43 16,
44 32,
45 64,
46 128,
47 256,
48 512,
49 1024,
50 2048,
51 3,
52 5,
53 7,
54 15,
55 17,
56 31,
57 33,
58 63,
59 65,
60 #ifdef __STDC_IEC_559__
61 nan,
62 inf,
63 -inf,
64 denorm_min,
65 -denorm_min,
66 norm_min / 3,
67 -norm_min / 3,
68 -T(),
69 -norm_min,
70 min,
71 T(),
72 #endif
73 norm_min,
74 max},
75 {10000,
76 #ifdef __STDC_IEC_559__
77 min / 2,
78 #else
79 norm_min,
80 #endif
81 max / 2},
82 MAKE_TESTER(log), MAKE_TESTER(log10), MAKE_TESTER(log1p),
83 MAKE_TESTER(log2), MAKE_TESTER(logb));
84 }