]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/pr86655.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / tr1 / 5_numerical_facilities / special_functions / 02_assoc_legendre / pr86655.cc
CommitLineData
f29a1ef2
ESR
1// { dg-do run }
2// { dg-options "-std=c++98 -ffp-contract=off" }
3
a945c346 4// Copyright (C) 2019-2024 Free Software Foundation, Inc.
f29a1ef2
ESR
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11//
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <tr1/cmath>
22#if defined(__TEST_DEBUG)
23# include <iostream>
24# define VERIFY(A) \
25 if (!(A)) \
26 { \
27 std::cout << "line " << __LINE__ \
28 << " std::tr1::assoc_legendre(l, m, x) == 0: " << (A) \
29 << '\n'; \
30 }
31#else
32# include <testsuite_hooks.h>
33#endif
34
35template<typename _Tp>
36 void
37 test_m_gt_l()
38 {
39 bool test __attribute__((unused)) = true;
40 unsigned int larr[4] = {0u, 1u, 2u, 5u};
41 for (unsigned int l = 0; l < 4; ++l)
42 for (unsigned int m = larr[l] + 1u; m <= larr[l] + 2u; ++m)
43 for (int i = -2; i <= +2; ++i)
44 {
45 _Tp x = _Tp(i * 0.5L);
46 VERIFY(std::tr1::assoc_legendre(larr[l], m, x) == _Tp(0));
47 }
48 }
49
50int
51main()
52{
53 test_m_gt_l<float>();
54 test_m_gt_l<double>();
55 test_m_gt_l<long double>();
56}