summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc
blob: df066fd7297f5362f93ba2a17b8aaba84b211142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (C) 2020-2022 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

// only: float|double|ldouble * * *
// expensive: * [1-9] * *
#include "bits/verify.h"
#include "bits/metahelpers.h"
#include "bits/mathreference.h"
#include "bits/test_values.h"

template <typename V>
  void
  test()
  {
    vir::test::setFuzzyness<float>(1);
    vir::test::setFuzzyness<double>(1);

    using T = typename V::value_type;
    constexpr T nan = std::__quiet_NaN_v<T>;
    constexpr T inf = std::__infinity_v<T>;
    constexpr T denorm_min = std::__denorm_min_v<T>;
    constexpr T norm_min = std::__norm_min_v<T>;
    constexpr T min = std::__finite_min_v<T>;
    constexpr T max = std::__finite_max_v<T>;
    test_values<V>({1,
		    2,
		    4,
		    8,
		    16,
		    32,
		    64,
		    128,
		    256,
		    512,
		    1024,
		    2048,
		    3,
		    5,
		    7,
		    15,
		    17,
		    31,
		    33,
		    63,
		    65,
#ifdef __STDC_IEC_559__
		    nan,
		    inf,
		    -inf,
		    denorm_min,
		    -denorm_min,
		    norm_min / 3,
		    -norm_min / 3,
		    -T(),
		    -norm_min,
		    min,
		    T(),
#endif
		    norm_min,
		    max},
		   {10000,
#ifdef __STDC_IEC_559__
		    min / 2,
#else
		    norm_min,
#endif
		    max / 2},
		   MAKE_TESTER(log), MAKE_TESTER(log10), MAKE_TESTER(log1p),
		   MAKE_TESTER(log2), MAKE_TESTER(logb));
  }