mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Merge pull request #1079 from boostorg/issue1075
Update pre-computed constexpr Gauss and Gauss-Kronrod constants
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1487,6 +1487,7 @@ test-suite quadrature :
|
||||
[ compile compile_test/gauss_concept_test.cpp : [ requires cxx11_auto_declarations cxx11_lambdas cxx11_smart_ptr cxx11_unified_initialization_syntax ] [ check-target-builds ../config//is_ci_sanitizer_run "Sanitizer CI run" : <build>no ] ]
|
||||
[ compile compile_test/gauss_kronrod_concept_test.cpp : [ requires cxx11_auto_declarations cxx11_lambdas cxx11_smart_ptr cxx11_unified_initialization_syntax ] [ check-target-builds ../config//is_ci_sanitizer_run "Sanitizer CI run" : <build>no ] ]
|
||||
[ run git_issue_898.cpp ]
|
||||
[ run git_issue_1075.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>"-Bstatic -lquadmath -Bdynamic" ] ]
|
||||
|
||||
[ run test_trapezoidal.cpp ../../test/build//boost_unit_test_framework : : :
|
||||
release [ requires cxx11_lambdas cxx11_auto_declarations cxx11_decltype cxx11_unified_initialization_syntax cxx11_variadic_templates ]
|
||||
|
||||
39
test/git_issue_1075.cpp
Normal file
39
test/git_issue_1075.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright John Maddock 2024.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/math/quadrature/gauss_kronrod.hpp>
|
||||
#include <boost/multiprecision/cpp_bin_float.hpp>
|
||||
|
||||
template <class T>
|
||||
void test()
|
||||
{
|
||||
auto f = [](const T& x){ return exp(-x * x / 2); };
|
||||
|
||||
T error = 0;
|
||||
|
||||
auto r = boost::math::quadrature::gauss_kronrod<T, 15>::integrate(f, 0, 1, 0, 0, &error);
|
||||
std::cout << r << std::endl;
|
||||
r = boost::math::quadrature::gauss_kronrod<T, 21>::integrate(f, 0, 1, 0, 0, &error);
|
||||
std::cout << r << std::endl;
|
||||
r = boost::math::quadrature::gauss_kronrod<T, 31>::integrate(f, 0, 1, 0, 0, &error);
|
||||
std::cout << r << std::endl;
|
||||
r = boost::math::quadrature::gauss_kronrod<T, 41>::integrate(f, 0, 1, 0, 0, &error);
|
||||
std::cout << r << std::endl;
|
||||
r = boost::math::quadrature::gauss_kronrod<T, 51>::integrate(f, 0, 1, 0, 0, &error);
|
||||
std::cout << r << std::endl;
|
||||
r = boost::math::quadrature::gauss_kronrod<T, 61>::integrate(f, 0, 1, 0, 0, &error);
|
||||
std::cout << r << std::endl;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
test<boost::multiprecision::cpp_bin_float_double>();
|
||||
test<boost::multiprecision::cpp_bin_float_double_extended>();
|
||||
test<boost::multiprecision::cpp_bin_float_quad>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user