From 8c4bac90e904d3f4a2115c7d014b856b07d6edf1 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 21 Mar 2021 09:14:15 +0300 Subject: [PATCH] Cleanup examples --- example/cstdfloat_example.cpp | 1 - example/numerical_derivative_example.cpp | 2 +- example/root_elliptic_finding.cpp | 5 ++--- example/root_finding_algorithms.cpp | 12 +++++------- example/root_n_finding_algorithms.cpp | 5 ++--- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/example/cstdfloat_example.cpp b/example/cstdfloat_example.cpp index 64caa220e..29af3a254 100644 --- a/example/cstdfloat_example.cpp +++ b/example/cstdfloat_example.cpp @@ -30,7 +30,6 @@ Dover, New York, 4th ed., (1945), pages 180-188. #include // for pow function. #include // For gamma function. //] [/cstdfloat_example_1] -#include #include diff --git a/example/numerical_derivative_example.cpp b/example/numerical_derivative_example.cpp index b60f46ba9..6f05c6ba0 100644 --- a/example/numerical_derivative_example.cpp +++ b/example/numerical_derivative_example.cpp @@ -10,10 +10,10 @@ # include # include # include +# include # include #include -#include #include // for float_distance //[numeric_derivative_example diff --git a/example/root_elliptic_finding.cpp b/example/root_elliptic_finding.cpp index 97cf74e42..28305c77a 100644 --- a/example/root_elliptic_finding.cpp +++ b/example/root_elliptic_finding.cpp @@ -16,8 +16,6 @@ #include #include -#include -#include #include #include #include @@ -49,6 +47,7 @@ using boost::multiprecision::cpp_bin_float_50; #include // std::ofstream #include #include // for type name using typid(thingy).name(); +#include #ifdef __FILE__ std::string sourcefilename = __FILE__; @@ -477,7 +476,7 @@ int test_root(cpp_bin_float_100 big_radius, cpp_bin_float_100 big_arc, cpp_bin_f using boost::timer::cpu_times; using boost::timer::cpu_timer; - long eval_count = boost::is_floating_point::value ? 1000000 : 10000; // To give a sufficiently stable timing for the fast built-in types, + long eval_count = std::is_floating_point::value ? 1000000 : 10000; // To give a sufficiently stable timing for the fast built-in types, // This takes an inconveniently long time for multiprecision cpp_bin_float_50 etc types. cpu_times now; // Holds wall, user and system times. diff --git a/example/root_finding_algorithms.cpp b/example/root_finding_algorithms.cpp index df2e68acc..c51439072 100644 --- a/example/root_finding_algorithms.cpp +++ b/example/root_finding_algorithms.cpp @@ -15,9 +15,6 @@ #include #include #include -#include -#include - #include "table_type.hpp" // Copy of i:\modular-boost\libs\math\test\table_type.hpp // #include "handle_test_result.hpp" @@ -55,6 +52,7 @@ using boost::multiprecision::cpp_bin_float_50; #include // std::ofstream #include #include // for type name using typid(thingy).name(); +#include #ifndef BOOST_ROOT # define BOOST_ROOT i:/modular-boost/ @@ -203,7 +201,7 @@ T cbrt_noderiv(T x) // Maybe guess should be double, or use enable_if to avoid warning about conversion double to float here? T guess; - if (boost::is_fundamental::value) + if (std::is_fundamental::value) { int exponent; frexp(x, &exponent); // Get exponent of z (ignore mantissa). @@ -257,7 +255,7 @@ T cbrt_deriv(T x) using namespace boost::math::tools; int exponent; T guess; - if(boost::is_fundamental::value) + if(std::is_fundamental::value) { frexp(x, &exponent); // Get exponent of z (ignore mantissa). guess = ldexp(static_cast(1), exponent / 3); // Rough guess is to divide the exponent by three. @@ -301,7 +299,7 @@ T cbrt_2deriv(T x) using namespace boost::math::tools; int exponent; T guess; - if(boost::is_fundamental::value) + if(std::is_fundamental::value) { frexp(x, &exponent); // Get exponent of z (ignore mantissa). guess = ldexp(static_cast(1), exponent / 3); // Rough guess is to divide the exponent by three. @@ -328,7 +326,7 @@ T cbrt_2deriv_s(T x) using namespace boost::math::tools; int exponent; T guess; - if(boost::is_fundamental::value) + if(std::is_fundamental::value) { frexp(x, &exponent); // Get exponent of z (ignore mantissa). guess = ldexp(static_cast(1), exponent / 3); // Rough guess is to divide the exponent by three. diff --git a/example/root_n_finding_algorithms.cpp b/example/root_n_finding_algorithms.cpp index 017d6e057..35a1adc78 100644 --- a/example/root_n_finding_algorithms.cpp +++ b/example/root_n_finding_algorithms.cpp @@ -16,8 +16,6 @@ #include #include -#include -#include #include #include @@ -50,6 +48,7 @@ using boost::multiprecision::cpp_bin_float_50; #include // std::ofstream #include #include // for type name using typid(thingy).name(); +#include #ifdef __FILE__ std::string sourcefilename = __FILE__; @@ -464,7 +463,7 @@ int test_root(cpp_bin_float_100 big_value, cpp_bin_float_100 answer, const char* using boost::timer::cpu_times; using boost::timer::cpu_timer; - int eval_count = boost::is_floating_point::value ? 10000000 : 100000; // To give a sufficiently stable timing for the fast built-in types, + int eval_count = std::is_floating_point::value ? 10000000 : 100000; // To give a sufficiently stable timing for the fast built-in types, //int eval_count = 1000000; // To give a sufficiently stable timing for the fast built-in types, // This takes an inconveniently long time for multiprecision cpp_bin_float_50 etc types.