]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/example/agm_example.cpp
import quincy beta 17.1.0
[ceph.git] / 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)
5 #include <iostream>
6 #include <boost/math/tools/agm.hpp>
7 #include <boost/math/constants/constants.hpp>
8 #include <boost/multiprecision/cpp_bin_float.hpp>
9
10 // This example computes the lemniscate constant to high precision using the agm:
11 using boost::math::tools::agm;
12 using boost::math::constants::pi;
13
14 int main() {
15 using Real = boost::multiprecision::cpp_bin_float_100;
16 Real G = agm(sqrt(Real(2)), Real(1));
17 std::cout << std::setprecision(std::numeric_limits<Real>::max_digits10);
18 std::cout << " Gauss's lemniscate constant = " << pi<Real>()/G << "\n";
19 std::cout << "Expected lemniscate constant = " << "2.62205755429211981046483958989111941368275495143162316281682170380079058707041425023029553296142909344613\n";
20 }