Debian Codegraph @

libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc

raw
1 // Copyright (C) 2020-2025 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/main.h"
21
22 template <typename V>
23 void
24 test()
25 {
26 vir::test::setFuzzyness<float>(1);
27 vir::test::setFuzzyness<double>(1);
28
29 using T = typename V::value_type;
30 #ifdef __STDC_IEC_559__
31 constexpr T nan = std::__quiet_NaN_v<T>;
32 constexpr T inf = std::__infinity_v<T>;
33 constexpr T denorm_min = std::__denorm_min_v<T>;
34 constexpr T min = std::__finite_min_v<T>;
35 #endif
36 constexpr T norm_min = std::__norm_min_v<T>;
37 constexpr T max = std::__finite_max_v<T>;
38 test_values<V>({1,
39 2,
40 4,
41 8,
42 16,
43 32,
44 64,
45 128,
46 256,
47 512,
48 1024,
49 2048,
50 3,
51 5,
52 7,
53 15,
54 17,
55 31,
56 33,
57 63,
58 65,
59 #ifdef __STDC_IEC_559__
60 nan,
61 inf,
62 -inf,
63 denorm_min,
64 -denorm_min,
65 norm_min / 3,
66 -norm_min / 3,
67 -T(),
68 -norm_min,
69 min,
70 T(),
71 #endif
72 norm_min,
73 max},
74 {10000,
75 #ifdef __STDC_IEC_559__
76 min / 2,
77 #else
78 norm_min,
79 #endif
80 max / 2},
81 MAKE_TESTER(log), MAKE_TESTER(log10), MAKE_TESTER(log1p),
82 MAKE_TESTER(log2), MAKE_TESTER(logb));
83 }