// (C) Copyright Nick Thompson 2020. // 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 #include #include #include #include using boost::math::tools::ulps_plot; using boost::math::tools::agm; int main() { using PreciseReal = boost::multiprecision::float128; using CoarseReal = float; auto agm_coarse = [](CoarseReal x) { return agm(x, CoarseReal(1)); }; auto agm_precise = [](PreciseReal x) { return agm(x, PreciseReal(1)); }; std::string filename = "agm_" + boost::core::demangle(typeid(CoarseReal).name()) + ".svg"; int samples = 2500; int width = 1100; PreciseReal clip = 100; auto plot = ulps_plot(agm_precise, CoarseReal(0), CoarseReal(10000), samples); plot.clip(clip).width(width); std::string title = "AGM ULP plot at " + boost::core::demangle(typeid(CoarseReal).name()) + " precision"; //plot.title(title); plot.vertical_lines(10); plot.add_fn(agm_coarse); plot.write(filename); }