]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/reporting/accuracy/test_rsqrt.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / reporting / accuracy / test_rsqrt.cpp
CommitLineData
20effc67
TL
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
6#include <boost/multiprecision/mpfr.hpp>
7#include <boost/multiprecision/float128.hpp>
8#include <boost/multiprecision/cpp_bin_float.hpp>
9#include <boost/math/tools/ulps_plot.hpp>
10#include <boost/math/special_functions/rsqrt.hpp>
11
12int main()
13{
14 using boost::multiprecision::number;
15 using PreciseReal = number<boost::multiprecision::mpfr_float_backend<1000>>;
16 using CoarseReal = boost::multiprecision::float128;
17 using boost::math::tools::ulps_plot;
18 std::string filename = "rsqrt_quad_0_100.svg";
19 int samples = 2500;
20 int width = 1100;
21 auto f = [](PreciseReal x) {
22 using boost::math::rsqrt;
23 return rsqrt(x);
24 };
1e59de90 25 auto plot03 = ulps_plot<decltype(f), PreciseReal, CoarseReal>(f, (std::numeric_limits<CoarseReal>::min)(), CoarseReal(100), samples);
20effc67
TL
26 plot03.width(width);
27 std::string title = "rsqrt ULPs plot at quad precision";
28 plot03.title(title);
29 plot03.vertical_lines(6);
30 auto g = [](CoarseReal x) {
31 return boost::math::rsqrt(x);
32 };
33 plot03.add_fn(g);
34 plot03.write(filename);
35}