]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/pr68397.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / tr1 / 5_numerical_facilities / special_functions / 15_expint / pr68397.cc
CommitLineData
83ffe9cd 1// Copyright (C) 2017-2023 Free Software Foundation, Inc.
4ba07ed4
ESR
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// PR libstdc++/68397 - std::tr1::expint fails in __expint_En_cont_frac
19// for some long double arguments due to low __max_iter value
20
21#include <tr1/cmath>
22#include <testsuite_hooks.h>
23
24void
25test01()
26{
27 // Answers from Wolfram Alpha.
28 long double ans_ok = -0.10001943365331651406888645149537315243646135979573L;
29 long double ans_bomb = -0.10777727809650077516264612749163100483995270163783L;
30
31 long double Ei_ok = std::tr1::expint(-1.500001L);
32 long double diff_ok = std::abs(Ei_ok - ans_ok);
33 VERIFY(diff_ok < 1.0e-15L);
34
35 long double Ei_bomb = std::tr1::expint(-1.450001L);
36 long double diff_bomb = std::abs(Ei_bomb - ans_bomb);
37 VERIFY(diff_bomb < 1.0e-15L);
38}
39
40int
41main()
42{
43 test01();
44 return 0;
45}
46