]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/example/agm_example.cpp
1 // (C) Copyright Nick Thompson 2020.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/math/tools/agm.hpp>
9 #include <boost/math/constants/constants.hpp>
11 #ifndef BOOST_MATH_STANDALONE
12 #include <boost/multiprecision/cpp_bin_float.hpp>
15 // This example computes the lemniscate constant to high precision using the agm:
16 using boost::math::tools::agm
;
17 using boost::math::constants::pi
;
22 #ifndef BOOST_MATH_STANDALONE
23 using Real
= boost::multiprecision::cpp_bin_float_100
;
25 using Real
= long double;
28 Real G
= agm(sqrt(Real(2)), Real(1));
29 std::cout
<< std::setprecision(std::numeric_limits
<Real
>::max_digits10
);
30 std::cout
<< " Gauss's lemniscate constant = " << pi
<Real
>()/G
<< "\n";
31 std::cout
<< "Expected lemniscate constant = " << "2.62205755429211981046483958989111941368275495143162316281682170380079058707041425023029553296142909344613\n";