diff --git a/doc/graphs/hypergeometric_1f1/.boost-no-inspect b/doc/graphs/hypergeometric_1f1/.boost-no-inspect new file mode 100644 index 000000000..e69de29bb diff --git a/doc/graphs/plot_1d_errors.cpp b/doc/graphs/plot_1d_errors.cpp index 73885f32e..6ccb81350 100644 --- a/doc/graphs/plot_1d_errors.cpp +++ b/doc/graphs/plot_1d_errors.cpp @@ -1,3 +1,7 @@ +// Copyright John Maddock 2018. +// 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 diff --git a/doc/math.css b/doc/math.css index 0a184a932..159b6ae04 100644 --- a/doc/math.css +++ b/doc/math.css @@ -16,6 +16,8 @@ ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Visual Studio is recommended for editing this file because it checks syntax, does layout and provides help on options. + + boost-no-inspect /*============================================================================= Program listings @@ -34,22 +36,15 @@ Program listings padding: 0.5pc 0.5pc 0.5pc 0.5pc; } -.programlisting, -.screen { - font-size: 10pt; - display: block; - /* was margin: 1pc 4% 0pc 4%; - but that led to overflow on some code lines, so reduced and lined up with blockquote indent (see below). */ - margin: 1pc 2% 0pc 2%; - /* https://www.w3schools.com/Css/css_margin.asp margin-top margin-right margin-bottom margin-left. - * auto - the browser calculates the margin - * length - specifies a margin in px, pt, cm, etc. - * % - specifies a margin in % of the width of the containing element - * inherit - specifies that the margin should be inherited from the parent element - - */ - padding: 0.5pc 0.5pc 0.5pc 0.5pc; -} + .programlisting, + .screen + { + font-size: 10pt; + display: block; + /* was margin: 1pc 4% 0pc 4%; */ + margin: 1pc 2% 0pc 2%; + padding: 0.5pc 0.5pc 0.5pc 0.5pc; + } @media screen { /* Syntax Highlighting */ @@ -146,7 +141,6 @@ span.gray { color: #808080; } /* light gray */ and a little bigger (* 125%) because the serif font appears smaller than the default sans serif fonts. Used, for example: [role serif_italic This is in serif font and italic]. Used in turn by template for inline expressions to match equations as SVG or PNG images. - */ span.serif_italic { font-family: serif; @@ -155,7 +149,7 @@ span.serif_italic { font-stretch: expanded; } -/* Custom indent of paragraphs to make equations look nicer, 2% to match that indent of code block above. +/* Custom indent of paragraphs to make equations look nicer. https://www.w3schools.com/tags/tag_blockquote.asp says "Most browsers will display the
element with left and right margin 40px values: " */ diff --git a/dot_net_example/boost_math/boost_math.cpp b/dot_net_example/boost_math/boost_math.cpp index 468b6d259..a7fabade9 100644 --- a/dot_net_example/boost_math/boost_math.cpp +++ b/dot_net_example/boost_math/boost_math.cpp @@ -16,7 +16,7 @@ // "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error"" // so command line shows: // /D "BOOST_MATH_ASSERT_UNDEFINED_POLICY=0" -// /D "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error"" +// /D "BOOST_MATH_OVERFLOW_ERROR_POLICY="errno_on_error"" #include "stdafx.h" @@ -92,7 +92,7 @@ any_distribution::any_distribution(int t, double arg1, double arg2, double arg3) break; case 17: this->reset(new concrete_distribution >(boost::math::negative_binomial_distribution<>(arg1, arg2))); - break; + break; case 18: this->reset(new concrete_distribution >(boost::math::non_central_beta_distribution<>(arg1, arg2, arg3))); break; @@ -133,10 +133,10 @@ any_distribution::any_distribution(int t, double arg1, double arg2, double arg3) this->reset(new concrete_distribution(boost::math::weibull(arg1, arg2))); break; - + default: // TODO Need some proper error handling here? - assert(0); + BOOST_ASSERT(0); } TRANSLATE_EXCEPTIONS_END } // any_distribution constructor. @@ -156,8 +156,8 @@ struct distribution_info double third_default; // 0 if there isn't a third argument. }; -distribution_info distributions[] = -{ // distribution name, parameter name(s) and default(s) +distribution_info distributions[] = +{ // distribution name, parameter name(s) and default(s) // Order must match any_distribution constructor above! // Null string "" and zero default for un-used arguments. { "Bernoulli", "Probability", "", "",0.5, 0, 0}, // case 0 diff --git a/example/arcsine_example.cpp b/example/arcsine_example.cpp index 7a27fb47e..a0070526c 100644 --- a/example/arcsine_example.cpp +++ b/example/arcsine_example.cpp @@ -18,6 +18,7 @@ #include #include +#include int main() { @@ -62,8 +63,8 @@ int main() using boost::math::arcsine_distribution; arcsine_distribution<> as(2, 5); // Cconstructs a double arcsine distribution. - assert(as.x_min() == 2.); // as.x_min() returns 2. - assert(as.x_max() == 5.); // as.x_max() returns 5. + BOOST_ASSERT(as.x_min() == 2.); // as.x_min() returns 2. + BOOST_ASSERT(as.x_max() == 5.); // as.x_max() returns 5. //] [/arcsine_snip_8] } return 0; diff --git a/example/big_seventh.cpp b/example/big_seventh.cpp index c661e2944..58c559010 100644 --- a/example/big_seventh.cpp +++ b/example/big_seventh.cpp @@ -1,4 +1,3 @@ - // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt @@ -52,16 +51,16 @@ int main() /*`Using `typedef cpp_dec_float_50` hides the complexity of multiprecision, allows us to define variables with 50 decimal digit precision just like built-in `double`. */ - using boost::multiprecision::cpp_dec_float_50; + using boost::multiprecision::cpp_dec_float_50; - cpp_dec_float_50 seventh = cpp_dec_float_50(1) / 7; // 1 / 7 + cpp_dec_float_50 seventh = cpp_dec_float_50(1) / 7; // 1 / 7 /*`By default, output would only show the standard 6 decimal digits, so set precision to show all 50 significant digits, including any trailing zeros. */ - std::cout.precision(std::numeric_limits::digits10); - std::cout << std::showpoint << std::endl; // Append any trailing zeros. - std::cout << seventh << std::endl; + std::cout.precision(std::numeric_limits::digits10); + std::cout << std::showpoint << std::endl; // Append any trailing zeros. + std::cout << seventh << std::endl; /*`which outputs: 0.14285714285714285714285714285714285714285714285714 diff --git a/example/binomial_coinflip_example.cpp b/example/binomial_coinflip_example.cpp index 0b831dde3..14940cb94 100644 --- a/example/binomial_coinflip_example.cpp +++ b/example/binomial_coinflip_example.cpp @@ -160,12 +160,12 @@ Finally, print two tables of probability for the /exactly/ and /at least/ a numb /*` The last (0 to 10 heads) must, of course, be 100% probability. */ - double probability = 0.3; - double q = quantile(flip, probability); - std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.3) = 3 - probability = 0.6; - q = quantile(flip, probability); - std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.6) = 5 + double probability = 0.3; + double q = quantile(flip, probability); + std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.3) = 3 + probability = 0.6; + q = quantile(flip, probability); + std::cout << "Quantile (flip, " << probability << ") = " << q << std::endl; // Quantile (flip, 0.6) = 5 } catch(const std::exception& e) { diff --git a/example/brent_minimise_example.cpp b/example/brent_minimise_example.cpp index 16bfbed40..09053bd03 100644 --- a/example/brent_minimise_example.cpp +++ b/example/brent_minimise_example.cpp @@ -58,7 +58,7 @@ using std::numeric_limits; // http://en.wikipedia.org/wiki/Brent%27s_method Brent's method -// An example of a function for which we want to find a minimum. +// An example of a function for which we want to find a minimum. double f(double x) { return (x + 3) * (x - 1) * (x - 1); @@ -68,7 +68,7 @@ double f(double x) struct funcdouble { double operator()(double const& x) - { + { return (x + 3) * (x - 1) * (x - 1); // (x + 3)(x - 1)^2 } }; @@ -79,7 +79,7 @@ struct func { template T operator()(T const& x) - { + { return (x + 3) * (x - 1) * (x - 1); // (x + 3)(x - 1)^2 } }; @@ -96,7 +96,7 @@ is_close_to(FPT left, FPT right, FPT tolerance) //[brent_minimise_close //! Compare if value got is close to expected, -//! checking first if expected is very small +//! checking first if expected is very small //! (to avoid divide by tiny or zero during comparison) //! before comparing expect with value got. @@ -136,7 +136,7 @@ void show_minima() std::cout << "\n\nFor type: " << typeid(T).name() << ",\n epsilon = " << std::numeric_limits::epsilon() // << ", precision of " << bits << " bits" - << ",\n the maximum theoretical precision from Brent's minimization is " + << ",\n the maximum theoretical precision from Brent's minimization is " << sqrt(std::numeric_limits::epsilon()) << "\n Displaying to std::numeric_limits::digits10 " << prec << ", significant decimal digits." << std::endl; @@ -165,7 +165,7 @@ void show_minima() } // Check that result is that expected (compared to theoretical uncertainty). T uncertainty = sqrt(std::numeric_limits::epsilon()); - std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is " + std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is " << is_close(static_cast(1), r.first, uncertainty) << std::endl; std::cout << std::boolalpha << "f(x) == (0 compared to uncertainty " << uncertainty << ") is " << is_close(static_cast(0), r.second, uncertainty) << std::endl; @@ -194,7 +194,7 @@ int main() // Tip - using // std::cout.precision(std::numeric_limits::digits10); - // during debugging is wise because it warns + // during debugging is wise because it warns // if construction of multiprecision involves conversion from double // by finding random or zero digits after 17th decimal digit. @@ -224,9 +224,9 @@ int main() using boost::math::fpc::is_small; std::cout << "x = " << r.first << ", f(x) = " << r.second << std::endl; - std::cout << std::boolalpha << "x == 1 (compared to uncertainty " + std::cout << std::boolalpha << "x == 1 (compared to uncertainty " << uncertainty << ") is " << is_close(1., r.first, uncertainty) << std::endl; // true - std::cout << std::boolalpha << "f(x) == 0 (compared to uncertainty " + std::cout << std::boolalpha << "f(x) == 0 (compared to uncertainty " << uncertainty << ") is " << is_close(0., r.second, uncertainty) << std::endl; // true //] [/brent_minimise_double_1a] @@ -248,11 +248,11 @@ int main() std::streamsize prec = static_cast(2 + sqrt((double)bits)); // Number of significant decimal digits. std::streamsize precision_3 = std::cout.precision(prec); // Save and set new precision. std::cout << "Showing " << bits << " bits " - "precision with " << prec + "precision with " << prec << " decimal digits from tolerance " << sqrt(std::numeric_limits::epsilon()) << std::endl; - std::cout << "x at minimum = " << r.first + std::cout << "x at minimum = " << r.first << ", f(" << r.first << ") = " << r.second << " after " << it << " iterations. " << std::endl; std::cout.precision(precision_3); // Restore. @@ -362,7 +362,7 @@ int main() typedef boost::multiprecision::number, boost::multiprecision::et_off> cpp_bin_float_50_et_off; - + typedef boost::multiprecision::number, boost::multiprecision::et_on> // et_on is default so is same as cpp_dec_float_50. cpp_dec_float_50_et_on; @@ -382,7 +382,7 @@ int main() std::cout << "Bracketing " << bracket_min << " to " << bracket_max << std::endl; const boost::uintmax_t maxit = 20; boost::uintmax_t it = maxit; // Will be updated with actual iteration count. - std::pair r + std::pair r = brent_find_minima(func(), bracket_min, bracket_max, bits, it); std::cout << "x at minimum = " << r.first << ",\n f(" << r.first << ") = " << r.second @@ -406,7 +406,7 @@ x == 1 (compared to uncertainty 7.311312755e-26) is true f(x) == (0 compared to uncertainty 7.311312755e-26) is true -4 1.3333333333333333333333333333333333333333333333333 x at minimum = 0.99999999999999999999999999998813903221565569205253, -f(0.99999999999999999999999999998813903221565569205253) = +f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58 14 iterations //] [/brent_minimise_mp_output_1] @@ -556,21 +556,21 @@ f(x) == 0 (compared to uncertainty 1.49012e-08) is true Type double with limited iterations. Precision bits = 53 -x at minimum = 1.00000, f(1.00000) = 5.04853e-18 after 10 iterations. +x at minimum = 1.00000, f(1.00000) = 5.04853e-18 after 10 iterations. Showing 53 bits precision with 9 decimal digits from tolerance 1.49011612e-08 -x at minimum = 1.00000000, f(1.00000000) = 5.04852568e-18 after 10 iterations. +x at minimum = 1.00000000, f(1.00000000) = 5.04852568e-18 after 10 iterations. Type double with limited iterations and half double bits. Showing 26 bits precision with 7 decimal digits from tolerance 0.000172633 x at minimum = 1.000000, f(1.000000) = 5.048526e-18 -10 iterations. +10 iterations. Type double with limited iterations and quarter double bits. Showing 13 bits precision with 5 decimal digits from tolerance 0.0156250 -x at minimum = 0.99998, f(0.99998) = 2.0070e-09, after 7 iterations. +x at minimum = 0.99998, f(0.99998) = 2.0070e-09, after 7 iterations. Type long double with limited iterations and all long double bits. -x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-18, after 10 iterations. +x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-18, after 10 iterations. For type: float, @@ -603,7 +603,7 @@ x == 1 (compared to uncertainty 1.490116e-08) is true f(x) == (0 compared to uncertainty 1.490116e-08) is true Bracketing -4.0000000000000000000000000000000000000000000000000 to 1.3333333333333333333333333333333333333333333333333 x at minimum = 0.99999999999999999999999999998813903221565569205253, -f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations. +f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58, after 14 iterations. For type: class boost::multiprecision::number,1>, @@ -616,7 +616,7 @@ x == 1 (compared to uncertainty 7.3113127550e-26) is true f(x) == (0 compared to uncertainty 7.3113127550e-26) is true -4.0000000000000000000000000000000000000000000000000 1.3333333333333333333333333333333333333333333333333 x at minimum = 0.99999999999999999999999999998813903221565569205253, f(0.99999999999999999999999999998813903221565569205253) = 5.6273022712501408640665300316078046703496236636624e-58 -14 iterations. +14 iterations. For type: class boost::multiprecision::number,1>, @@ -727,4 +727,4 @@ met 84 bits precision, after 14 iterations. x == 1 (compared to uncertainty 7.3113127550e-26) is true f(x) == (0 compared to uncertainty 7.3113127550e-26) is true -*/ \ No newline at end of file +*/ diff --git a/example/distribution_construction.cpp b/example/distribution_construction.cpp index 451fd5d15..a3d1a635d 100644 --- a/example/distribution_construction.cpp +++ b/example/distribution_construction.cpp @@ -116,7 +116,7 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this: negative_binomial mydist11(5, 0.4); // Using provided typedef of type double, and int and double arguments. /*` This is probably the most common usage. - Other combination are possible too: + Other combination are possible too: */ negative_binomial mydist12(5., 0.4F); // Double and float arguments. negative_binomial mydist13(5, 1); // Both arguments integer. @@ -177,7 +177,7 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this: // Explicit long double precision: negative_binomial_distribution mydist7(8., 0.25); - + /*` And you can use your own template RealType, for example, `boost::math::cpp_bin_float_50` (an arbitrary 50 decimal digits precision type), @@ -189,8 +189,8 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this: // `integer` arguments are promoted to your RealType exactly, but // `double` argument are converted to RealType, // most likely losing precision! - - // So DON'T be tempted to write the 'obvious': + + // So DON'T be tempted to write the 'obvious': negative_binomial_distribution mydist20(8, 0.23456789012345678901234567890); // to avoid truncation of second parameter to `0.2345678901234567` and loss of precision. @@ -199,7 +199,7 @@ and a success fraction 0.25, 25% or 1 in 4, is constructed like this: // Ensure that all potentially significant digits are shown. std::cout.precision(std::numeric_limits::digits10); - // + // cpp_bin_float_50 x("1.23456789012345678901234567890"); std::cout << pdf(mydist8, x) << std::endl; /*` showing 0.00012630010495970320103876754721976419438231705359935 diff --git a/example/hyperexponential_snips.cpp b/example/hyperexponential_snips.cpp index 609c1164d..785e500d2 100644 --- a/example/hyperexponential_snips.cpp +++ b/example/hyperexponential_snips.cpp @@ -72,7 +72,7 @@ int main() hyperexponential he(rates.begin(), rates.end()); - assert(he.probabilities()[0] == 0.5); // Phase probabilities will be equal and normalised to unity. + BOOST_ASSERT(he.probabilities()[0] == 0.5); // Phase probabilities will be equal and normalised to unity. //] } { @@ -81,7 +81,7 @@ int main() hyperexponential he(rates); - assert(he.probabilities()[0] == 0.5); // Phase probabilities will be equal and normalised to unity. + BOOST_ASSERT(he.probabilities()[0] == 0.5); // Phase probabilities will be equal and normalised to unity. //] } #endif @@ -95,7 +95,7 @@ int main() //[hyperexponential_snip7 hyperexponential he = { 1.0 / 10, 1.0 / 12 }; - assert(he.probabilities()[0] == 0.5); + BOOST_ASSERT(he.probabilities()[0] == 0.5); //] } #endif diff --git a/example/lambert_w_example.cpp b/example/lambert_w_example.cpp index 88a1fb13a..28dbdf8a3 100644 --- a/example/lambert_w_example.cpp +++ b/example/lambert_w_example.cpp @@ -100,7 +100,7 @@ int main() std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.567143 // This 'golden ratio' for exponentials is http://mathworld.wolfram.com/OmegaConstant.html // since exp[-W(1)] = W(1) - // A030178 Decimal expansion of LambertW(1): the solution to x*exp(x) + // A030178 Decimal expansion of LambertW(1): the solution to x*exp(x) // = 0.5671432904097838729999686622103555497538157871865125081351310792230457930866 // http://oeis.org/A030178 @@ -167,7 +167,7 @@ int main() std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 std::cout << " 1 - sqrt(eps) = " << static_cast(1) - sqrt(std::numeric_limits::epsilon()) << std::endl; x = -exp_minus_one(); - // N[lambert_w[-0.36787944117144233],17] == -1.000000000000000 + 6.7595465843924897×10^-9 i + // N[lambert_w[-0.36787944117144233],17] == -1.000000000000000 + 6.7595465843924897*10^-9i std::cout << "Lambert W (" << x << ") = " << lambert_w(x) << std::endl; // 0.0 // At Singularity - 0.36787944117144233 == -0.36787944117144233 returned - 1.0000000000000000 // Lambert W(-0.36787944117144233) = -1.0000000000000000 diff --git a/example/nonfinite_facet_sstream.cpp b/example/nonfinite_facet_sstream.cpp index 686ff94c2..9c44edb71 100644 --- a/example/nonfinite_facet_sstream.cpp +++ b/example/nonfinite_facet_sstream.cpp @@ -56,7 +56,7 @@ int main() double inf = numeric_limits::infinity(); oss << inf; // Write out. cout << "infinity output was " << oss.str() << endl; - assert(oss.str() == "inf"); + BOOST_ASSERT(oss.str() == "inf"); } { istringstream iss; @@ -65,7 +65,7 @@ int main() double inf; iss >> inf; // Read from "inf" cout << "Infinity input was " << iss.str() << endl; - assert(inf == numeric_limits::infinity()); + BOOST_ASSERT(inf == numeric_limits::infinity()); } { @@ -74,10 +74,10 @@ int main() ss.imbue(new_locale); double inf = numeric_limits::infinity(); ss << inf; // Write out. - assert(ss.str() == "inf"); + BOOST_ASSERT(ss.str() == "inf"); double r; ss >> r; // Read back in. - assert(inf == r); // Confirms that the double values really are identical. + BOOST_ASSERT(inf == r); // Confirms that the double values really are identical. cout << "infinity output was " << ss.str() << endl; cout << "infinity input was " << r << endl; @@ -96,7 +96,7 @@ int main() double nan = numeric_limits::quiet_NaN(); ss << nan; // Write out. - assert(ss.str() == "nan"); + BOOST_ASSERT(ss.str() == "nan"); double v; ss >> v; // Read back in. diff --git a/example/nonfinite_legacy.cpp b/example/nonfinite_legacy.cpp index 11b84e6a2..2e73fc2fc 100644 --- a/example/nonfinite_legacy.cpp +++ b/example/nonfinite_legacy.cpp @@ -61,7 +61,7 @@ int main() cout << "infinity output was " << inf << endl; cout << "infinity input was " << r << endl; - assert(inf == r); + BOOST_ASSERT(inf == r); } { stringstream ss; @@ -75,8 +75,8 @@ int main() cout << "NaN output was " << nan << endl; cout << "NaN input was " << v << endl; - // assert(nan == v); // Always fails because NaN == NaN fails! - // assert(nan == numeric_limits::quiet_NaN()); asserts! + // BOOST_ASSERT(nan == v); // Always fails because NaN == NaN fails! + // BOOST_ASSERT(nan == numeric_limits::quiet_NaN()); asserts! } } // int main() diff --git a/example/nonfinite_loopback_ok.cpp b/example/nonfinite_loopback_ok.cpp index adeea76c3..70ccd24b9 100644 --- a/example/nonfinite_loopback_ok.cpp +++ b/example/nonfinite_loopback_ok.cpp @@ -54,19 +54,19 @@ int main() return 0; } //locale old_locale; // Current global locale. - // Create tmp_locale and store the output nonfinite_num_put facet in it. + // Create tmp_locale and store the output nonfinite_num_put facet in it. //locale tmp_locale(old_locale, new nonfinite_num_put); - // Create new_locale and store the input nonfinite_num_get facet in it. + // Create new_locale and store the input nonfinite_num_get facet in it. //locale new_locale(tmp_locale, new nonfinite_num_get); - // Can only add one facet at a time, hence need a tmp_locale. - // Unless we write: + // Can only add one facet at a time, hence need a tmp_locale, + // unless we write: std::locale new_locale(std::locale(std::locale(std::locale(), new boost::math::nonfinite_num_put), new boost::math::nonfinite_num_get)); - + stringstream ss; // Both input and output, so need both get and put facets. - + ss.imbue(new_locale); double inf = numeric_limits::infinity(); @@ -74,7 +74,7 @@ int main() double r; ss >> r; // Read back in. - assert(inf == r); // OK MSVC <= 10.0! + BOOST_ASSERT(inf == r); // OK MSVC <= 10.0! } // int main() diff --git a/example/nonfinite_num_facet_serialization.cpp b/example/nonfinite_num_facet_serialization.cpp index 2fd2d4461..e2972a10f 100644 --- a/example/nonfinite_num_facet_serialization.cpp +++ b/example/nonfinite_num_facet_serialization.cpp @@ -41,9 +41,9 @@ static const char sep = ','; // Separator of bracketed float and double values. -// Use max_digits10 (or equivalent) to obtain +// Use max_digits10 (or equivalent) to obtain // all potentially significant decimal digits for the floating-point types. - + #ifdef BOOST_NO_CXX11_NUMERIC_LIMITS std::streamsize max_digits10_float = 2 + std::numeric_limits::digits * 30103UL / 100000UL; std::streamsize max_digits10_double = 2 + std::numeric_limits::digits * 30103UL / 100000UL; @@ -176,7 +176,7 @@ int main (void) #ifdef BOOST_NO_CXX11_NUMERIC_LIMITS std::cout << "BOOST_NO_CXX11_NUMERIC_LIMITS is defined, so no max_digits10 available either," "using our own version instead." << std::endl; -#endif +#endif std::cout << "std::numeric_limits::max_digits10 is " << max_digits10_float << std::endl; std::cout << "std::numeric_limits::max_digits10 is " << max_digits10_double << std::endl; @@ -247,7 +247,8 @@ int main (void) f3.print (std::clog, "f3"); std::locale the_out_locale (the_default_locale, new boost::math::nonfinite_num_put); - std::ofstream fout ("nonfinite_archive_test.txt"); + // Use a temporary folder .temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ofstream fout ("./.temps/nonfinite_archive_test.txt"); fout.imbue (the_out_locale); boost::archive::text_oarchive toar (fout, boost::archive::no_codecvt); // Write to archive. @@ -261,7 +262,8 @@ int main (void) { std::clog << "Deserialize (Boost text archive)..." << std::endl; std::locale the_in_locale (the_default_locale, new boost::math::nonfinite_num_get); - std::ifstream fin ("nonfinite_archive_test.txt"); + // Use a temporary folder .temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ifstream fin ("./.temps/nonfinite_archive_test.txt"); fin.imbue (the_in_locale); boost::archive::text_iarchive tiar (fin, boost::archive::no_codecvt); foo f0, f1, f2, f3; @@ -293,7 +295,8 @@ int main (void) f3.print (std::clog, "f3"); std::locale the_out_locale (the_default_locale, new boost::math::nonfinite_num_put); - std::ofstream fout ("nonfinite_XML_archive_test.txt"); + // Use a temporary folder /.temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ofstream fout ("./.temps/nonfinite_XML_archive_test.txt"); fout.imbue (the_out_locale); boost::archive::xml_oarchive xoar (fout, boost::archive::no_codecvt); @@ -307,7 +310,8 @@ int main (void) { std::clog << "Deserialize (Boost XML archive)..." << std::endl; std::locale the_in_locale (the_default_locale, new boost::math::nonfinite_num_get); - std::ifstream fin ("nonfinite_XML_archive_test.txt"); + // Use a temporary folder /.temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + std::ifstream fin ("./.temps/nonfinite_XML_archive_test.txt"); // Previously written above. fin.imbue (the_in_locale); boost::archive::xml_iarchive xiar (fin, boost::archive::no_codecvt); foo f0, f1, f2, f3; @@ -337,16 +341,16 @@ Output: std::numeric_limits::max_digits10 is 8 std::numeric_limits::max_digits10 is 17 Construct some foo structures with a finite and nonfinites. - f0 : + f0 : |-- fvalue = 3.141593 `-- dvalue = 3.14159265358979 - f1 : + f1 : |-- fvalue = -1.#INF `-- dvalue = -1.#INF - f2 : + f2 : |-- fvalue = 1.#INF `-- dvalue = 1.#INF - f3 : + f3 : |-- fvalue = 1.#QNAN `-- dvalue = 1.#QNAN Write to a string buffer. @@ -355,72 +359,72 @@ Output: Read foo structures from a string buffer. Input is: `(3.1415927,3.1415926535897931)(-inf,-inf)(inf,inf)(nan,nan)' Read OK. - f0 : + f0 : |-- fvalue = 3.141593 `-- dvalue = 3.14159265358979 - f1 : + f1 : |-- fvalue = -1.#INF `-- dvalue = -1.#INF - f2 : + f2 : |-- fvalue = 1.#INF `-- dvalue = 1.#INF - f3 : + f3 : |-- fvalue = 1.#QNAN `-- dvalue = 1.#QNAN Done input from istringstream. Serialize (using Boost text archive). - f0 : + f0 : |-- fvalue = 3.141593 `-- dvalue = 3.14159265358979 - f1 : + f1 : |-- fvalue = -1.#INF `-- dvalue = -1.#INF - f2 : + f2 : |-- fvalue = 1.#INF `-- dvalue = 1.#INF - f3 : + f3 : |-- fvalue = 1.#QNAN `-- dvalue = 1.#QNAN Done. Deserialize (Boost text archive)... - f0 : + f0 : |-- fvalue = 3.141593 `-- dvalue = 3.14159265358979 - f1 : + f1 : |-- fvalue = -1.#INF `-- dvalue = -1.#INF - f2 : + f2 : |-- fvalue = 1.#INF `-- dvalue = 1.#INF - f3 : + f3 : |-- fvalue = 1.#QNAN `-- dvalue = 1.#QNAN Done. Serialize (Boost XML archive)... - f0 : + f0 : |-- fvalue = 3.141593 `-- dvalue = 3.14159265358979 - f1 : + f1 : |-- fvalue = -1.#INF `-- dvalue = -1.#INF - f2 : + f2 : |-- fvalue = 1.#INF `-- dvalue = 1.#INF - f3 : + f3 : |-- fvalue = 1.#QNAN `-- dvalue = 1.#QNAN Done. Deserialize (Boost XML archive)... - f0 : + f0 : |-- fvalue = 3.141593 `-- dvalue = 3.14159265358979 - f1 : + f1 : |-- fvalue = -1.#INF `-- dvalue = -1.#INF - f2 : + f2 : |-- fvalue = 1.#INF `-- dvalue = 1.#INF - f3 : + f3 : |-- fvalue = 1.#QNAN `-- dvalue = 1.#QNAN Done. diff --git a/example/nonfinite_serialization_archives.cpp b/example/nonfinite_serialization_archives.cpp index 355108f94..f39a8a612 100644 --- a/example/nonfinite_serialization_archives.cpp +++ b/example/nonfinite_serialization_archives.cpp @@ -80,7 +80,7 @@ Otherwise, loading the archive may fail. By default, archives are saved and loaded with a classic C locale with a `boost::archive::codecvt_null` facet added. Normally you do not have to worry about that. -The constructors for the archive classes, as a side-effect, +The constructors for the archive classes, as a side-effect, imbue the stream with such a locale. However, if you want to use the facets `nonfinite_num_put` and `nonfinite_num_get` @@ -112,17 +112,17 @@ int main() // codecvt_null so the archive constructor will not imbue the stream with a new locale. locale my_locale(default_locale, new nonfinite_num_put); - // Add nonfinite_num_put facet to locale. + // Add nonfinite_num_put facet to locale. - ofstream ofs("test.txt"); - ofs.imbue(my_locale); + // Use a temporary folder /.temps (which contains "boost-no-inspect" so that it will not be inspected, and made 'hidden' too). + ofstream ofs("./.temps/test.txt"); + ofs.imbue(my_locale); boost::archive::text_oarchive oa(ofs, no_codecvt); double x = numeric_limits::infinity(); oa & x; - } // int main() diff --git a/example/ooura_fourier_integrals_cosine_example.cpp b/example/ooura_fourier_integrals_cosine_example.cpp index 218e94e1c..2269202d3 100644 --- a/example/ooura_fourier_integrals_cosine_example.cpp +++ b/example/ooura_fourier_integrals_cosine_example.cpp @@ -18,42 +18,42 @@ int main() { - try - { - std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + try + { + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. - using boost::math::quadrature::ooura_fourier_cos; - using boost::math::constants::half_pi; - using boost::math::constants::e; + using boost::math::quadrature::ooura_fourier_cos; + using boost::math::constants::half_pi; + using boost::math::constants::e; //[ooura_fourier_integrals_cosine_example_1 - auto integrator = ooura_fourier_cos(); - // Use the default tolerance root_epsilon and eight levels for type double. + auto integrator = ooura_fourier_cos(); + // Use the default tolerance root_epsilon and eight levels for type double. - auto f = [](double x) - { // More complex example function. - return 1 / (x * x + 1); - }; + auto f = [](double x) + { // More complex example function. + return 1 / (x * x + 1); + }; - double omega = 1; + double omega = 1; - auto [result, relative_error] = integrator.integrate(f, omega); - std::cout << "Integral = " << result << ", relative error estimate " << relative_error << std::endl; + auto [result, relative_error] = integrator.integrate(f, omega); + std::cout << "Integral = " << result << ", relative error estimate " << relative_error << std::endl; - //] [/ooura_fourier_integrals_cosine_example_1] + //] [/ooura_fourier_integrals_cosine_example_1] - //[ooura_fourier_integrals_cosine_example_2 + //[ooura_fourier_integrals_cosine_example_2 - constexpr double expected = half_pi() / e(); - std::cout << "pi/(2e) = " << expected << ", difference " << result - expected << std::endl; - //] [/ooura_fourier_integrals_cosine_example_2] - } - catch (std::exception const & ex) - { - // Lacking try&catch blocks, the program will abort after any throw, whereas the - // message below from the thrown exception will give some helpful clues as to the cause of the problem. - std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; - } + constexpr double expected = half_pi() / e(); + std::cout << "pi/(2e) = " << expected << ", difference " << result - expected << std::endl; + //] [/ooura_fourier_integrals_cosine_example_2] + } + catch (std::exception const & ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + } } // int main() diff --git a/example/ooura_fourier_integrals_example.cpp b/example/ooura_fourier_integrals_example.cpp index 45f01df90..22a9d015a 100644 --- a/example/ooura_fourier_integrals_example.cpp +++ b/example/ooura_fourier_integrals_example.cpp @@ -22,40 +22,40 @@ int main() { - try - { - std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + try + { + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. - using boost::math::quadrature::ooura_fourier_sin; + using boost::math::quadrature::ooura_fourier_sin; using boost::math::constants::half_pi; //[ooura_fourier_integrals_example_1 - ooura_fourier_sinintegrator = ooura_fourier_sin(); - // Use the default tolerance root_epsilon and eight levels for type double. + ooura_fourier_sinintegrator = ooura_fourier_sin(); + // Use the default tolerance root_epsilon and eight levels for type double. - auto f = [](double x) - { // Simple reciprocal function for sinc. - return 1 / x; - }; + auto f = [](double x) + { // Simple reciprocal function for sinc. + return 1 / x; + }; - double omega = 1; - std::pair result = integrator.integrate(f, omega); - std::cout << "Integral = " << result.first << ", relative error estimate " << result.second << std::endl; + double omega = 1; + std::pair result = integrator.integrate(f, omega); + std::cout << "Integral = " << result.first << ", relative error estimate " << result.second << std::endl; //] [/ooura_fourier_integrals_example_1] //[ooura_fourier_integrals_example_2 - constexpr double expected = half_pi(); - std::cout << "pi/2 = " << expected << ", difference " << result.first - expected << std::endl; + constexpr double expected = half_pi(); + std::cout << "pi/2 = " << expected << ", difference " << result.first - expected << std::endl; //] [/ooura_fourier_integrals_example_2] - } - catch (std::exception const & ex) - { - // Lacking try&catch blocks, the program will abort after any throw, whereas the - // message below from the thrown exception will give some helpful clues as to the cause of the problem. - std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; - } + } + catch (std::exception const & ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + } } // int main() /* diff --git a/example/ooura_fourier_integrals_multiprecision_example.cpp b/example/ooura_fourier_integrals_multiprecision_example.cpp index 98eb394fc..f2ac13194 100644 --- a/example/ooura_fourier_integrals_multiprecision_example.cpp +++ b/example/ooura_fourier_integrals_multiprecision_example.cpp @@ -24,47 +24,47 @@ int main() { - try - { - typedef boost::multiprecision::cpp_bin_float_quad Real; + try + { + typedef boost::multiprecision::cpp_bin_float_quad Real; - std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. + std::cout.precision(std::numeric_limits::max_digits10); // Show all potentially significant digits. - using boost::math::quadrature::ooura_fourier_cos; - using boost::math::constants::half_pi; - using boost::math::constants::e; + using boost::math::quadrature::ooura_fourier_cos; + using boost::math::constants::half_pi; + using boost::math::constants::e; - //[ooura_fourier_integrals_multiprecision_example_1 + //[ooura_fourier_integrals_multiprecision_example_1 - // Use the default parameters for tolerance root_epsilon and eight levels for a type of 8 bytes. - //auto integrator = ooura_fourier_cos(); - // Decide on a (tight) tolerance. - const Real tol = 2 * std::numeric_limits::epsilon(); - auto integrator = ooura_fourier_cos(tol, 8); // Loops or gets worse for more than 8. + // Use the default parameters for tolerance root_epsilon and eight levels for a type of 8 bytes. + //auto integrator = ooura_fourier_cos(); + // Decide on a (tight) tolerance. + const Real tol = 2 * std::numeric_limits::epsilon(); + auto integrator = ooura_fourier_cos(tol, 8); // Loops or gets worse for more than 8. - auto f = [](Real x) - { // More complex example function. - return 1 / (x * x + 1); - }; + auto f = [](Real x) + { // More complex example function. + return 1 / (x * x + 1); + }; - double omega = 1; - auto [result, relative_error] = integrator.integrate(f, omega); + double omega = 1; + auto [result, relative_error] = integrator.integrate(f, omega); - //] [/ooura_fourier_integrals_multiprecision_example_1] + //] [/ooura_fourier_integrals_multiprecision_example_1] - //[ooura_fourier_integrals_multiprecision_example_2 - std::cout << "Integral = " << result << ", relative error estimate " << relative_error << std::endl; + //[ooura_fourier_integrals_multiprecision_example_2 + std::cout << "Integral = " << result << ", relative error estimate " << relative_error << std::endl; - const Real expected = half_pi() / e(); // Expect integral = 1/(2e) - std::cout << "pi/(2e) = " << expected << ", difference " << result - expected << std::endl; - //] [/ooura_fourier_integrals_multiprecision_example_2] - } - catch (std::exception const & ex) - { - // Lacking try&catch blocks, the program will abort after any throw, whereas the - // message below from the thrown exception will give some helpful clues as to the cause of the problem. - std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; - } + const Real expected = half_pi() / e(); // Expect integral = 1/(2e) + std::cout << "pi/(2e) = " << expected << ", difference " << result - expected << std::endl; + //] [/ooura_fourier_integrals_multiprecision_example_2] + } + catch (std::exception const & ex) + { + // Lacking try&catch blocks, the program will abort after any throw, whereas the + // message below from the thrown exception will give some helpful clues as to the cause of the problem. + std::cout << "\n""Message from thrown exception was:\n " << ex.what() << std::endl; + } } // int main() /* diff --git a/example/series.cpp b/example/series.cpp index ee758f947..8bfce824f 100644 --- a/example/series.cpp +++ b/example/series.cpp @@ -4,6 +4,8 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include +#include + #include #include #include @@ -22,7 +24,7 @@ struct log1p_series { // This is the function operator invoked by the summation // algorithm, the first call to this operator should return - // the first term of the series, the second call the second + // the first term of the series, the second call the second // term and so on. m_prod *= m_mult; return m_prod / ++k; @@ -40,7 +42,7 @@ template T log1p(T x) { // We really should add some error checking on x here! - assert(std::fabs(x) < 1); + BOOST_ASSERT(std::fabs(x) < 1); // Construct the series functor: log1p_series s(x); @@ -65,7 +67,7 @@ struct log1p_series > { // This is the function operator invoked by the summation // algorithm, the first call to this operator should return - // the first term of the series, the second call the second + // the first term of the series, the second call the second // term and so on. m_prod *= m_mult; return m_prod / T(++k); @@ -82,7 +84,7 @@ template std::complex log1p(std::complex x) { // We really should add some error checking on x here! - assert(abs(x) < 1); + BOOST_ASSERT(abs(x) < 1); // Construct the series functor: log1p_series > s(x); diff --git a/include/boost/math/cstdfloat/cstdfloat_types.hpp b/include/boost/math/cstdfloat/cstdfloat_types.hpp index 5fc2d19b2..07006c961 100644 --- a/include/boost/math/cstdfloat/cstdfloat_types.hpp +++ b/include/boost/math/cstdfloat/cstdfloat_types.hpp @@ -229,7 +229,7 @@ #define BOOST_CSTDFLOAT_FLOAT128_MIN 3.36210314311209350626267781732175260e-4932Q #define BOOST_CSTDFLOAT_FLOAT128_MAX 1.18973149535723176508575932662800702e+4932Q #define BOOST_CSTDFLOAT_FLOAT128_EPS 1.92592994438723585305597794258492732e-0034Q - #define BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN 6.475175119438025110924438958227646552e-4966Q + #define BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN 6.475175119438025110924438958227646552e-4966Q #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support) diff --git a/include/boost/math/differentiation/autodiff.hpp b/include/boost/math/differentiation/autodiff.hpp index e98eecab6..a8894141d 100644 --- a/include/boost/math/differentiation/autodiff.hpp +++ b/include/boost/math/differentiation/autodiff.hpp @@ -1819,7 +1819,7 @@ fvar digamma(fvar const& cr) { if BOOST_AUTODIFF_IF_CONSTEXPR (order == 0) return fvar(d0); else { - static_assert(order <= static_cast(std::numeric_limits::max()), + static_assert(order <= static_cast((std::numeric_limits::max)()), "order exceeds maximum derivative for boost::math::polygamma()."); return cr.apply_derivatives( order, [&x, &d0](size_t i) { return i ? boost::math::polygamma(static_cast(i), x) : d0; }); @@ -1904,7 +1904,7 @@ fvar lgamma(fvar const& cr) { if BOOST_AUTODIFF_IF_CONSTEXPR (order == 0) return fvar(d0); else { - static_assert(order <= static_cast(std::numeric_limits::max()) + 1, + static_assert(order <= static_cast((std::numeric_limits::max)()) + 1, "order exceeds maximum derivative for boost::math::polygamma()."); return cr.apply_derivatives( order, [&x, &d0](size_t i) { return i ? boost::math::polygamma(static_cast(i - 1), x) : d0; }); diff --git a/include/boost/math/interpolators/barycentric_rational.hpp b/include/boost/math/interpolators/barycentric_rational.hpp index 9b4c90e08..5419c70af 100644 --- a/include/boost/math/interpolators/barycentric_rational.hpp +++ b/include/boost/math/interpolators/barycentric_rational.hpp @@ -18,7 +18,8 @@ * A disadvantage of this interpolant is that it does not reproduce rational functions; for example, 1/(1+x^2) is not interpolated exactly. * * References: - * Floater, Michael S., and Kai Hormann. "Barycentric rational interpolation with no poles and high rates of approximation." Numerische Mathematik 107.2 (2007): 315-331. + * Floater, Michael S., and Kai Hormann. "Barycentric rational interpolation with no poles and high rates of approximation." +* Numerische Mathematik 107.2 (2007): 315-331. * Press, William H., et al. "Numerical recipes third edition: the art of scientific computing." Cambridge University Press 32 (2007): 10013-2473. */ diff --git a/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp b/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp index ab7b479b2..b4199ea26 100644 --- a/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp +++ b/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp @@ -177,7 +177,7 @@ Real barycentric_rational_imp::operator()(Real x) const * http://www.ams.org/journals/mcom/1986-47-175/S0025-5718-1986-0842136-8/S0025-5718-1986-0842136-8.pdf * and reviewed in * Recent developments in barycentric rational interpolation - * Jean–Paul Berrut, Richard Baltensperger and Hans D. Mittelmann + * Jean-Paul Berrut, Richard Baltensperger and Hans D. Mittelmann * * Is it possible to complete this in one pass through the data? */ diff --git a/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp b/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp index 044ac7217..4998348ce 100644 --- a/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp +++ b/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp @@ -145,8 +145,8 @@ public: const char* err_msg = "Tried to evaluate the cardinal quadratic b-spline outside the domain of of interpolation; extrapolation does not work."; throw std::domain_error(err_msg); } - // Let k, γ be defined via t = t0 + kh + γh. - // Now find all j: |k-j+1+γ|< 3/2, or, in other words + // Let k, gamma be defined via t = t0 + kh + gamma * h. + // Now find all j: |k-j+1+gamma|< 3/2, or, in other words // j_min = ceil((t-t0)/h - 1/2) // j_max = floor(t-t0)/h + 5/2) using std::floor; @@ -171,8 +171,8 @@ public: const char* err_msg = "Tried to evaluate the cardinal quadratic b-spline outside the domain of of interpolation; extrapolation does not work."; throw std::domain_error(err_msg); } - // Let k, γ be defined via t = t0 + kh + γh. - // Now find all j: |k-j+1+γ|< 3/2, or, in other words + // Let k, gamma be defined via t = t0 + kh + gamma * h. + // Now find all j: |k-j+1+gamma|< 3/2, or, in other words // j_min = ceil((t-t0)/h - 1/2) // j_max = floor(t-t0)/h + 5/2) using std::floor; diff --git a/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp b/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp index a449c29b5..5dc249933 100644 --- a/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp +++ b/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp @@ -60,12 +60,12 @@ std::pair ooura_sin_node_and_weight(long n, Real h, Real alpha) if (n == 0) { // Equation 44 of https://arxiv.org/pdf/0911.4796.pdf - // Fourier Transform of the Stretched Exponential Function: Analytic Error Bounds, - // Double Exponential Transform, and Open-Source Implementation, - // Joachim Wuttke, - // The C library libkww provides functions to compute the Kohlrausch-Williams-Watts function, - // the Laplace-Fourier transform of the stretched (or compressed) exponential function exp(-t^beta) - // for exponent beta between 0.1 and 1.9 with sixteen decimal digits accuracy. + // Fourier Transform of the Stretched Exponential Function: Analytic Error Bounds, + // Double Exponential Transform, and Open-Source Implementation, + // Joachim Wuttke, + // The C library libkww provides functions to compute the Kohlrausch-Williams-Watts function, + // the Laplace-Fourier transform of the stretched (or compressed) exponential function exp(-t^beta) + // for exponent beta between 0.1 and 1.9 with sixteen decimal digits accuracy. Real eta_prime_0 = Real(2) + alpha + Real(1)/Real(4); Real node = pi()/(eta_prime_0*h); @@ -148,9 +148,9 @@ std::pair ooura_cos_node_and_weight(long n, Real h, Real alpha) Real phi_prime = -(expm1_meta + x*exp_meta*eta_prime)/(expm1_meta*expm1_meta); // Takuya Ooura and Masatake Mori, - // Journal of Computational and Applied Mathematics, 112 (1999) 229-241. - // A robust double exponential formula for Fourier-type integrals. - // Equation 4.6 + // Journal of Computational and Applied Mathematics, 112 (1999) 229-241. + // A robust double exponential formula for Fourier-type integrals. + // Equation 4.6 Real s = pi(); Real arg; if (eta < -1) { @@ -175,8 +175,8 @@ class ooura_fourier_sin_detail { public: ooura_fourier_sin_detail(const Real relative_error_goal, size_t levels) { #ifdef BOOST_MATH_INSTRUMENT_OOURA - std::cout << "ooura_fourier_sin with relative error goal " << relative_error_goal - << " & " << levels << " levels." << std::endl; + std::cout << "ooura_fourier_sin with relative error goal " << relative_error_goal + << " & " << levels << " levels." << std::endl; #endif // BOOST_MATH_INSTRUMENT_OOURA if (relative_error_goal < std::numeric_limits::epsilon() * 2) { throw std::domain_error("The relative error goal cannot be smaller than the unit roundoff."); @@ -245,9 +245,9 @@ public: print_ooura_estimate(i, I0, I1, omega); #endif Real absolute_error_estimate = abs(I0-I1); - Real scale = max(abs(I0), abs(I1)); + Real scale = (max)(abs(I0), abs(I1)); if (!isnan(I1) && absolute_error_estimate <= rel_err_goal_*scale) { - starting_level_ = max(long(i) - 1, long(0)); + starting_level_ = (max)(long(i) - 1, long(0)); return {I0/omega, absolute_error_estimate/scale}; } I1 = I0; @@ -273,12 +273,12 @@ public: } Real I0 = estimate_integral(f, omega, ii); Real absolute_error_estimate = abs(I0-I1); - Real scale = max(abs(I0), abs(I1)); + Real scale = (max)(abs(I0), abs(I1)); #ifdef BOOST_MATH_INSTRUMENT_OOURA print_ooura_estimate(ii, I0, I1, omega); #endif if (absolute_error_estimate <= rel_err_goal_*scale) { - starting_level_ = max(long(ii) - 1, long(0)); + starting_level_ = (max)(long(ii) - 1, long(0)); return {I0/omega, absolute_error_estimate/scale}; } I1 = I0; @@ -433,9 +433,9 @@ class ooura_fourier_cos_detail { public: ooura_fourier_cos_detail(const Real relative_error_goal, size_t levels) { #ifdef BOOST_MATH_INSTRUMENT_OOURA - std::cout << "ooura_fourier_cos with relative error goal " << relative_error_goal - << " & " << levels << " levels." << std::endl; - std::cout << "epsilon for type = " << std::numeric_limits::epsilon() << std::endl; + std::cout << "ooura_fourier_cos with relative error goal " << relative_error_goal + << " & " << levels << " levels." << std::endl; + std::cout << "epsilon for type = " << std::numeric_limits::epsilon() << std::endl; #endif // BOOST_MATH_INSTRUMENT_OOURA if (relative_error_goal < std::numeric_limits::epsilon() * 2) { throw std::domain_error("The relative error goal cannot be smaller than the unit roundoff!"); @@ -488,9 +488,9 @@ public: print_ooura_estimate(i, I0, I1, omega); #endif absolute_error_estimate = abs(I0-I1); - scale = max(abs(I0), abs(I1)); + scale = (max)(abs(I0), abs(I1)); if (!isnan(I1) && absolute_error_estimate <= rel_err_goal_*scale) { - starting_level_ = max(long(i) - 1, long(0)); + starting_level_ = (max)(long(i) - 1, long(0)); return {I0/omega, absolute_error_estimate/scale}; } I1 = I0; @@ -513,9 +513,9 @@ public: print_ooura_estimate(ii, I0, I1, omega); #endif absolute_error_estimate = abs(I0-I1); - scale = max(abs(I0), abs(I1)); + scale = (max)(abs(I0), abs(I1)); if (absolute_error_estimate <= rel_err_goal_*scale) { - starting_level_ = max(long(ii) - 1, long(0)); + starting_level_ = (max)(long(ii) - 1, long(0)); return {I0/omega, absolute_error_estimate/scale}; } I1 = I0; diff --git a/include/boost/math/special_functions/detail/hypergeometric_1F1_by_ratios.hpp b/include/boost/math/special_functions/detail/hypergeometric_1F1_by_ratios.hpp index a6a6ed074..36babad81 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_1F1_by_ratios.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_1F1_by_ratios.hpp @@ -31,8 +31,7 @@ having to apply one extra recurrence to convert from an a or b recurrence to an a+b one. - See: H. SHINTAN, Note on Miller’s recurrence algorithm, J. Sci. Hiroshima Univ. Ser. A-I - Math., 29 (1965), pp. 121-133. + See: H. Shintan, Note on Miller's recurrence algorithm, J. Sci. Hiroshima Univ. Ser. A-I Math., 29 (1965), pp. 121-133. Also: Computational Aspects of Three Term Recurrence Relations, SIAM Review, January 1967. The following table lists by experiment, how large z can be in order to diff --git a/include/boost/math/special_functions/detail/hypergeometric_1F1_negative_b_regions.hpp b/include/boost/math/special_functions/detail/hypergeometric_1F1_negative_b_regions.hpp index f63de9c73..aa878ed4f 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_1F1_negative_b_regions.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_1F1_negative_b_regions.hpp @@ -423,7 +423,7 @@ namespace boost { { // // Crossover point is decreasing with increasing a - // upper limit is fine, lower limit is not: + // upper limit is fine, lower limit is not: // if (b > b_max) return 0; // TODO: don't know what else to do??? diff --git a/include/boost/math/special_functions/hypergeometric_1F1.hpp b/include/boost/math/special_functions/hypergeometric_1F1.hpp index 34da7a7ac..3351cc2a2 100644 --- a/include/boost/math/special_functions/hypergeometric_1F1.hpp +++ b/include/boost/math/special_functions/hypergeometric_1F1.hpp @@ -591,10 +591,10 @@ namespace boost { namespace math { namespace detail { // Actual result will be result * e^log_scaling. // #ifndef BOOST_NO_CXX11_THREAD_LOCAL - static const thread_local int max_scaling = itrunc(boost::math::tools::log_max_value()) - 2; - static const thread_local T max_scale_factor = exp(T(max_scaling)); + static const thread_local int max_scaling = itrunc(boost::math::tools::log_max_value()) - 2; + static const thread_local T max_scale_factor = exp(T(max_scaling)); #else - int max_scaling = itrunc(boost::math::tools::log_max_value()) - 2; + int max_scaling = itrunc(boost::math::tools::log_max_value()) - 2; T max_scale_factor = exp(T(max_scaling)); #endif @@ -620,8 +620,8 @@ namespace boost { namespace math { namespace detail { int log_scaling = 0; T result = hypergeometric_1F1_imp(a, b, z, pol, log_scaling); if (sign) - *sign = result < 0 ? -1 : 1; - result = log(fabs(result)) + log_scaling; + *sign = result < 0 ? -1 : 1; + result = log(fabs(result)) + log_scaling; return result; } @@ -634,14 +634,14 @@ namespace boost { namespace math { namespace detail { // // Actual result will be result * e^log_scaling / tgamma(b). // - int result_sign = 1; - T scale = log_scaling - boost::math::lgamma(b, &result_sign, pol); + int result_sign = 1; + T scale = log_scaling - boost::math::lgamma(b, &result_sign, pol); #ifndef BOOST_NO_CXX11_THREAD_LOCAL static const thread_local T max_scaling = boost::math::tools::log_max_value() - 2; - static const thread_local T max_scale_factor = exp(max_scaling); + static const thread_local T max_scale_factor = exp(max_scaling); #else - T max_scaling = boost::math::tools::log_max_value() - 2; - T max_scale_factor = exp(max_scaling); + T max_scaling = boost::math::tools::log_max_value() - 2; + T max_scale_factor = exp(max_scaling); #endif while (scale > max_scaling) @@ -652,7 +652,7 @@ namespace boost { namespace math { namespace detail { while (scale < -max_scaling) { result /= max_scale_factor; - scale += max_scaling; + scale += max_scaling; } if (scale != 0) result *= exp(scale); @@ -718,57 +718,57 @@ inline typename tools::promote_args::type hypergeometric_1F1_regular template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z, const Policy& /* pol */) { - BOOST_FPU_EXCEPTION_GUARD - typedef typename tools::promote_args::type result_type; - typedef typename policies::evaluation::type value_type; - typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, - policies::discrete_quantile<>, - policies::assert_undefined<> >::type forwarding_policy; - return policies::checked_narrowing_cast( - detail::log_hypergeometric_1F1_imp( - static_cast(a), - static_cast(b), - static_cast(z), - 0, - forwarding_policy()), - "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); + BOOST_FPU_EXCEPTION_GUARD + typedef typename tools::promote_args::type result_type; + typedef typename policies::evaluation::type value_type; + typedef typename policies::normalise< + Policy, + policies::promote_float, + policies::promote_double, + policies::discrete_quantile<>, + policies::assert_undefined<> >::type forwarding_policy; + return policies::checked_narrowing_cast( + detail::log_hypergeometric_1F1_imp( + static_cast(a), + static_cast(b), + static_cast(z), + 0, + forwarding_policy()), + "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); } template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z) { - return log_hypergeometric_1F1(a, b, z, policies::policy<>()); + return log_hypergeometric_1F1(a, b, z, policies::policy<>()); } template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z, int* sign, const Policy& /* pol */) { - BOOST_FPU_EXCEPTION_GUARD - typedef typename tools::promote_args::type result_type; - typedef typename policies::evaluation::type value_type; - typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, - policies::discrete_quantile<>, - policies::assert_undefined<> >::type forwarding_policy; - return policies::checked_narrowing_cast( - detail::log_hypergeometric_1F1_imp( - static_cast(a), - static_cast(b), - static_cast(z), - sign, - forwarding_policy()), - "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); + BOOST_FPU_EXCEPTION_GUARD + typedef typename tools::promote_args::type result_type; + typedef typename policies::evaluation::type value_type; + typedef typename policies::normalise< + Policy, + policies::promote_float, + policies::promote_double, + policies::discrete_quantile<>, + policies::assert_undefined<> >::type forwarding_policy; + return policies::checked_narrowing_cast( + detail::log_hypergeometric_1F1_imp( + static_cast(a), + static_cast(b), + static_cast(z), + sign, + forwarding_policy()), + "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); } template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z, int* sign) { - return log_hypergeometric_1F1(a, b, z, sign, policies::policy<>()); + return log_hypergeometric_1F1(a, b, z, sign, policies::policy<>()); } diff --git a/include/boost/math/special_functions/hypergeometric_pFq.hpp b/include/boost/math/special_functions/hypergeometric_pFq.hpp index babafc72c..db92f630a 100644 --- a/include/boost/math/special_functions/hypergeometric_pFq.hpp +++ b/include/boost/math/special_functions/hypergeometric_pFq.hpp @@ -111,13 +111,13 @@ namespace boost { for (auto ai = aj.begin(); ai != aj.end(); ++ai) { - current_precision = std::max(current_precision, ai->precision()); + current_precision = (std::max)(current_precision, ai->precision()); } for (auto bi = bj.begin(); bi != bj.end(); ++bi) { - current_precision = std::max(current_precision, bi->precision()); + current_precision = (std::max)(current_precision, bi->precision()); } - current_precision = std::max(current_precision, z.precision()); + current_precision = (std::max)(current_precision, z.precision()); Real r, norm; std::vector aa(aj), bb(bj); diff --git a/include/boost/math/special_functions/lambert_w.hpp b/include/boost/math/special_functions/lambert_w.hpp index 65d3be5f5..f34fc91e2 100644 --- a/include/boost/math/special_functions/lambert_w.hpp +++ b/include/boost/math/special_functions/lambert_w.hpp @@ -1231,10 +1231,10 @@ inline T lambert_w0_imp(T z, const Policy& pol, const mpl::int_<1>&) static const char* function = "boost::math::lambert_w0<%1%>"; // For error messages. BOOST_MATH_STD_USING // Aid ADL of std functions. - if ((boost::math::isnan)(z)) - { - return boost::math::policies::raise_domain_error(function, "Expected a value > -e^-1 (-0.367879...) but got %1%.", z, pol); - } + if ((boost::math::isnan)(z)) + { + return boost::math::policies::raise_domain_error(function, "Expected a value > -e^-1 (-0.367879...) but got %1%.", z, pol); + } if ((boost::math::isinf)(z)) { return boost::math::policies::raise_overflow_error(function, "Expected a finite value but got %1%.", z, pol); @@ -1633,7 +1633,7 @@ inline T lambert_w0_imp(T z, const Policy& pol, const mpl::int_<2>&) // Detect unusual case of 32-bit double with a wider/64-bit long double BOOST_STATIC_ASSERT_MSG(std::numeric_limits::digits >= 53, "Our double precision coefficients will be truncated, " - "please file a bug report with details of your platform's floating point types " + "please file a bug report with details of your platform's floating point types " "- or possibly edit the coefficients to have " "an appropriate size-suffix for 64-bit floats on your platform - L?"); diff --git a/include/boost/math/tools/recurrence.hpp b/include/boost/math/tools/recurrence.hpp index b090ae7a0..bebdc0447 100644 --- a/include/boost/math/tools/recurrence.hpp +++ b/include/boost/math/tools/recurrence.hpp @@ -23,7 +23,7 @@ namespace boost { // // Function ratios directly from recurrence relations: - // H. SHINTAN, Note on Miller’s recurrence algorithm, J. Sci. Hiroshima Univ. Ser. A-I + // H. Shintan, Note on Miller's recurrence algorithm, J. Sci. Hiroshima Univ. Ser. A-I // Math., 29 (1965), pp. 121 - 133. // and: // COMPUTATIONAL ASPECTS OF THREE-TERM RECURRENCE RELATIONS diff --git a/include/boost/math/tools/roots.hpp b/include/boost/math/tools/roots.hpp index 50b204585..aac3c93c4 100644 --- a/include/boost/math/tools/roots.hpp +++ b/include/boost/math/tools/roots.hpp @@ -246,8 +246,8 @@ T newton_raphson_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_ boost::uintmax_t count(max_iter); #ifdef BOOST_MATH_INSTRUMENT - std::cout << "Newton_raphson_iterate, guess = " << guess << ", min = " << min << ", max = " << max - << ", digits = " << digits << ", max_iter = " << max_iter << std::endl; + std::cout << "Newton_raphson_iterate, guess = " << guess << ", min = " << min << ", max = " << max + << ", digits = " << digits << ", max_iter = " << max_iter << std::endl; #endif do{ @@ -321,7 +321,7 @@ T newton_raphson_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_ { max_count = max_iter; // std::cout << "Maximum iterations: " << max_iter << std::endl; - // Puzzled what this tells us, so commented out for now? + // Puzzled what this tells us, so commented out for now? } #endif @@ -481,8 +481,8 @@ namespace detail{ BOOST_MATH_STD_USING #ifdef BOOST_MATH_INSTRUMENT - std::cout << "Second order root iteration, guess = " << guess << ", min = " << min << ", max = " << max - << ", digits = " << digits << ", max_iter = " << max_iter << std::endl; + std::cout << "Second order root iteration, guess = " << guess << ", min = " << min << ", max = " << max + << ", digits = " << digits << ", max_iter = " << max_iter << std::endl; #endif T f0(0), f1, f2; @@ -763,7 +763,7 @@ Complex complex_newton(F g, Complex guess, int max_iterations=std::numeric_limit // See: https://math.stackexchange.com/questions/3017766/constructing-newton-iteration-converging-to-non-root // If f' is continuous, then convergence of x_n -> x* implies f(x*) = 0. // This condition approximates this convergence condition by requiring three consecutive iterates to be clustered. - Real tol = max(abs(z2)*std::numeric_limits::epsilon(), std::numeric_limits::epsilon()); + Real tol = (max)(abs(z2)*std::numeric_limits::epsilon(), std::numeric_limits::epsilon()); bool real_close = abs(z0.real() - z1.real()) < tol && abs(z0.real() - z2.real()) < tol && abs(z1.real() - z2.real()) < tol; bool imag_close = abs(z0.imag() - z1.imag()) < tol && abs(z0.imag() - z2.imag()) < tol && abs(z1.imag() - z2.imag()) < tol; if (real_close && imag_close) diff --git a/reporting/accuracy/doc/accuracy_tables.qbk b/reporting/accuracy/doc/accuracy_tables.qbk index 6ea445d99..549006373 100644 --- a/reporting/accuracy/doc/accuracy_tables.qbk +++ b/reporting/accuracy/doc/accuracy_tables.qbk @@ -4352,3 +4352,11 @@ underflow[br]30, 8.58993e+09, -8.44974e-268[br]underflow[br]30, 1.71799e+10, -7. [errors_GNU_C_version_7_1_0_linux_double_polygamma_GSL_2_1_Mathematica_Data_negative_arguments] [errors_GNU_C_version_7_1_0_linux_double_polygamma_GSL_2_1_Mathematica_Data_large_arguments] ] + + +[/ + Copyright 2015 John Maddock and Paul A. Bristow. + Distributed under 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). +] \ No newline at end of file diff --git a/reporting/performance/doc/performance_tables.qbk b/reporting/performance/doc/performance_tables.qbk index f1075550b..a76eb7753 100644 --- a/reporting/performance/doc/performance_tables.qbk +++ b/reporting/performance/doc/performance_tables.qbk @@ -1701,3 +1701,9 @@ boost 1.64]] ] ] +[/ + Copyright 2015 John Maddock and Paul A. Bristow. + Distributed under 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). +] \ No newline at end of file diff --git a/test/__temporary_test.cpp b/test/__temporary_test.cpp index 0f3221541..f9e827328 100644 --- a/test/__temporary_test.cpp +++ b/test/__temporary_test.cpp @@ -1,4 +1,8 @@ -// +// Copyright John Maddock 2018 +// Distributed under 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) + // This test file exists to output diagnostic info for tests failing in the online matrix // for perplexing reasons, it's contents are subject to constant change!! // diff --git a/test/hypergeometric_0F2.ipp b/test/hypergeometric_0F2.ipp index ed22d5d68..33e327b6a 100644 --- a/test/hypergeometric_0F2.ipp +++ b/test/hypergeometric_0F2.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2008. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1F1.ipp b/test/hypergeometric_1F1.ipp index 946293558..6f16dac01 100644 --- a/test/hypergeometric_1F1.ipp +++ b/test/hypergeometric_1F1.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1F1_big.ipp b/test/hypergeometric_1F1_big.ipp index 273dc11b4..39672f8a1 100644 --- a/test/hypergeometric_1F1_big.ipp +++ b/test/hypergeometric_1F1_big.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1F1_big_double_limited.ipp b/test/hypergeometric_1F1_big_double_limited.ipp index 3aff79bbc..112d27994 100644 --- a/test/hypergeometric_1F1_big_double_limited.ipp +++ b/test/hypergeometric_1F1_big_double_limited.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1F1_big_unsolved.ipp b/test/hypergeometric_1F1_big_unsolved.ipp index 8b2e1be7a..4a098d851 100644 --- a/test/hypergeometric_1F1_big_unsolved.ipp +++ b/test/hypergeometric_1F1_big_unsolved.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1F1_small_random.ipp b/test/hypergeometric_1F1_small_random.ipp index 37829f52f..e87443cce 100644 --- a/test/hypergeometric_1F1_small_random.ipp +++ b/test/hypergeometric_1F1_small_random.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1F2.ipp b/test/hypergeometric_1F2.ipp index 797e3ea32..98ae293ae 100644 --- a/test/hypergeometric_1F2.ipp +++ b/test/hypergeometric_1F2.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1f1_large_regularized.ipp b/test/hypergeometric_1f1_large_regularized.ipp index 955cfda77..d0c0320cb 100644 --- a/test/hypergeometric_1f1_large_regularized.ipp +++ b/test/hypergeometric_1f1_large_regularized.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1f1_log_large.ipp b/test/hypergeometric_1f1_log_large.ipp index 2c64f5253..12ef5fcb1 100644 --- a/test/hypergeometric_1f1_log_large.ipp +++ b/test/hypergeometric_1f1_log_large.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_1f1_log_large_unsolved.ipp b/test/hypergeometric_1f1_log_large_unsolved.ipp index 478b4a599..cf8762bb1 100644 --- a/test/hypergeometric_1f1_log_large_unsolved.ipp +++ b/test/hypergeometric_1f1_log_large_unsolved.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_2F0.ipp b/test/hypergeometric_2F0.ipp index 74dd3605e..fda443728 100644 --- a/test/hypergeometric_2F0.ipp +++ b/test/hypergeometric_2F0.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_2F0_half.ipp b/test/hypergeometric_2F0_half.ipp index f9dc3afe1..7b801653d 100644 --- a/test/hypergeometric_2F0_half.ipp +++ b/test/hypergeometric_2F0_half.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_2F0_integer_a2.ipp b/test/hypergeometric_2F0_integer_a2.ipp index f2fdab235..aaad5ac91 100644 --- a/test/hypergeometric_2F0_integer_a2.ipp +++ b/test/hypergeometric_2F0_integer_a2.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_2F0_large_z.ipp b/test/hypergeometric_2F0_large_z.ipp index 55d781a9b..5c74426e2 100644 --- a/test/hypergeometric_2F0_large_z.ipp +++ b/test/hypergeometric_2F0_large_z.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_2F1.ipp b/test/hypergeometric_2F1.ipp index 1b8a57f4a..67794b3e5 100644 --- a/test/hypergeometric_2F1.ipp +++ b/test/hypergeometric_2F1.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/hypergeometric_2F2.ipp b/test/hypergeometric_2F2.ipp index 11a61b9c2..46fd170d7 100644 --- a/test/hypergeometric_2F2.ipp +++ b/test/hypergeometric_2F2.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/math_unit_test.hpp b/test/math_unit_test.hpp index 4cefd8d14..9fe49c7c3 100644 --- a/test/math_unit_test.hpp +++ b/test/math_unit_test.hpp @@ -3,6 +3,7 @@ // Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) + #ifndef BOOST_MATH_TEST_TEST_HPP #define BOOST_MATH_TEST_TEST_HPP #include @@ -13,7 +14,6 @@ #include #include - namespace boost { namespace math { namespace test { namespace detail { @@ -39,7 +39,7 @@ bool check_mollified_close(Real expected, Real computed, Real tol, std::string c } using std::max; using std::abs; - Real denom = max(abs(expected), Real(1)); + Real denom = (max)(abs(expected), Real(1)); Real mollified_relative_error = abs(expected - computed)/denom; if (mollified_relative_error > tol) { @@ -92,7 +92,7 @@ bool check_ulp_close(PreciseReal expected1, Real computed, size_t ulps, std::str if (dist > ulps) { detail::total_ulp_distance += static_cast(dist); - Real denom = max(abs(expected), Real(1)); + Real denom = (max)(abs(expected), Real(1)); Real mollified_relative_error = abs(expected - computed)/denom; std::ios_base::fmtflags f( std::cerr.flags() ); std::cerr << std::setprecision(3); diff --git a/test/norms_test.cpp b/test/norms_test.cpp index b176fa6c7..266d6d920 100644 --- a/test/norms_test.cpp +++ b/test/norms_test.cpp @@ -70,7 +70,7 @@ std::vector generate_random_vector(size_t size, size_t seed) else if constexpr (std::is_integral::value) { // Rescaling by larger than 2 is UB! - std::uniform_int_distribution dis(std::numeric_limits::lowest()/2, std::numeric_limits::max()/2); + std::uniform_int_distribution dis(std::numeric_limits::lowest()/2, (std::numeric_limits::max)()/2); for (size_t i = 0; i < v.size(); ++i) { v[i] = dis(gen); @@ -136,7 +136,7 @@ void test_lp() // Does it work with ublas vectors? // Does it handle the overflow of intermediates? boost::numeric::ublas::vector w(4); - Real bignum = sqrt(std::numeric_limits::max())/256; + Real bignum = sqrt((std::numeric_limits::max)())/256; for (size_t i = 0; i < w.size(); ++i) { w[i] = bignum; @@ -629,7 +629,7 @@ void test_l2_norm() l2 = boost::math::tools::l2_norm(w); BOOST_TEST(abs(l2 - 2) < tol); - Real bignum = 4*sqrt(std::numeric_limits::max()); + Real bignum = 4*sqrt((std::numeric_limits::max)()); v[0] = bignum; v[1] = 0; v[2] = 0; diff --git a/test/sinc_data.ipp b/test/sinc_data.ipp index 8f687eacc..d4232a347 100644 --- a/test/sinc_data.ipp +++ b/test/sinc_data.ipp @@ -1,3 +1,10 @@ +// Copyright John Maddock 2019. + +// 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) + #ifndef SC_ # define SC_(x) static_cast(BOOST_JOIN(x, L)) #endif diff --git a/test/test_autodiff.hpp b/test/test_autodiff.hpp index 9a312af97..6970102d4 100644 --- a/test/test_autodiff.hpp +++ b/test/test_autodiff.hpp @@ -72,10 +72,10 @@ using if_t = if_c; */ template struct test_constants_t { - static constexpr auto n_samples = if_t, bmp::is_number_expression>, mp11::mp_int<10>, mp11::mp_int<25>>::value; + static constexpr auto n_samples = if_t, bmp::is_number_expression>, mp11::mp_int<10>, mp11::mp_int<25>>::value; static constexpr auto order = OrderValue; static constexpr T pct_epsilon() BOOST_NOEXCEPT { - return (is_multiprecision_t::value ? 2 : 1) * std::numeric_limits::epsilon() * 100; + return (is_multiprecision_t::value ? 2 : 1) * std::numeric_limits::epsilon() * 100; } }; @@ -103,8 +103,8 @@ struct RandomSample { "both be not integral"); using dist_t = if_t, - std::uniform_real_distribution>; + std::uniform_int_distribution, + std::uniform_real_distribution>; struct get_integral_endpoint { template diff --git a/test/test_recurrence.cpp b/test/test_recurrence.cpp index c9d6c0ab2..89a999521 100644 --- a/test/test_recurrence.cpp +++ b/test/test_recurrence.cpp @@ -12,7 +12,8 @@ #include #include #include -#include +#include +//#include #include #ifdef BOOST_MSVC diff --git a/test/univariate_statistics_test.cpp b/test/univariate_statistics_test.cpp index 181da0153..7552480b3 100644 --- a/test/univariate_statistics_test.cpp +++ b/test/univariate_statistics_test.cpp @@ -57,7 +57,7 @@ std::vector generate_random_vector(size_t size, size_t seed) else if constexpr (std::is_integral::value) { // Rescaling by larger than 2 is UB! - std::uniform_int_distribution dis(std::numeric_limits::lowest()/2, std::numeric_limits::max()/2); + std::uniform_int_distribution dis(std::numeric_limits::lowest()/2, (std::numeric_limits::max)()/2); for (size_t i = 0; i < v.size(); ++i) { v[i] = dis(gen); diff --git a/tools/bessel_data.cpp b/tools/bessel_data.cpp index e6c7c23d6..6c9503587 100644 --- a/tools/bessel_data.cpp +++ b/tools/bessel_data.cpp @@ -302,7 +302,7 @@ int main(int argc, char* argv[]) letter = "y"; } else - assert(0); + BOOST_ASSERT(0); } bool cont; @@ -314,11 +314,11 @@ int main(int argc, char* argv[]) get_user_parameter_info(arg1, "v"); get_user_parameter_info(arg2, "x"); mp_t (*fp)(mp_t, mp_t); - if(functype == func_J) + if(functype == func_J) fp = cyl_bessel_j_bare; - else if(functype == func_I) + else if(functype == func_I) fp = cyl_bessel_i_bare; - else if(functype == func_K) + else if(functype == func_K) fp = cyl_bessel_k_bare; else if(functype == func_Y) fp = cyl_neumann_bare; @@ -327,7 +327,7 @@ int main(int argc, char* argv[]) else if(functype == func_y) fp = sph_bessel_y_bare; else - assert(0); + BOOST_ASSERT(0); data.insert(fp, arg1, arg2); diff --git a/tools/bessel_derivative_data.cpp b/tools/bessel_derivative_data.cpp index fb86c8a6d..672002032 100644 --- a/tools/bessel_derivative_data.cpp +++ b/tools/bessel_derivative_data.cpp @@ -114,7 +114,7 @@ int cpp_main(int argc, char*argv []) letter = "y"; } else - assert(0); + BOOST_ASSERT(0); } bool cont; @@ -142,7 +142,7 @@ int cpp_main(int argc, char*argv []) else if(functype == func_y) fp = sph_bessel_y_derivative_bare; else - assert(0); + BOOST_ASSERT(0); data.insert(fp, arg2, arg1); diff --git a/tools/bessel_derivative_data_from_bessel_ipps.cpp b/tools/bessel_derivative_data_from_bessel_ipps.cpp index a6cec8e69..fb9f6f38a 100644 --- a/tools/bessel_derivative_data_from_bessel_ipps.cpp +++ b/tools/bessel_derivative_data_from_bessel_ipps.cpp @@ -204,7 +204,7 @@ int main(int argc, char*argv []) letter = "y"; } else - assert(0); + BOOST_ASSERT(0); } ::processFiles(functype); diff --git a/tools/hyp_1f1_big_data.cpp b/tools/hyp_1f1_big_data.cpp index 1bd79b251..4bef9d2ff 100644 --- a/tools/hyp_1f1_big_data.cpp +++ b/tools/hyp_1f1_big_data.cpp @@ -89,7 +89,7 @@ struct hypergeometric_1f1_gen { throw std::domain_error(""); } - if (fabs(result) > std::numeric_limits::max()) + if (fabs(result) > (std::numeric_limits::max)()) { std::cout << "Rejecting over large value\n"; throw std::domain_error(""); @@ -172,7 +172,7 @@ int main(int, char* []) std::ofstream ofs(line.c_str()); ofs << std::scientific << std::setprecision(40); write_code(ofs, data, line.c_str()); - + return 0; } diff --git a/tools/hyp_1f1_log_big_data.cpp b/tools/hyp_1f1_log_big_data.cpp index b4dc3f13e..ab8b09e48 100644 --- a/tools/hyp_1f1_log_big_data.cpp +++ b/tools/hyp_1f1_log_big_data.cpp @@ -37,7 +37,7 @@ struct hypergeometric_1f1_gen { throw std::domain_error(""); } - if (fabs(result) > std::numeric_limits::max()) + if (fabs(result) > (std::numeric_limits::max)()) { std::cout << "Rejecting over large value\n"; throw std::domain_error(""); @@ -125,7 +125,7 @@ int main(int, char* []) std::ofstream ofs(line.c_str()); ofs << std::scientific << std::setprecision(40); write_code(ofs, data, line.c_str()); - + return 0; } diff --git a/tools/hyp_1f1_reg_big_data.cpp b/tools/hyp_1f1_reg_big_data.cpp index 4eb0bd0ae..6989547e7 100644 --- a/tools/hyp_1f1_reg_big_data.cpp +++ b/tools/hyp_1f1_reg_big_data.cpp @@ -37,7 +37,7 @@ struct hypergeometric_1f1_gen { throw std::domain_error(""); } - if (fabs(result) > std::numeric_limits::max()) + if (fabs(result) > (std::numeric_limits::max)()) { std::cout << "Rejecting over large value\n"; throw std::domain_error(""); @@ -120,7 +120,7 @@ int main(int, char* []) std::ofstream ofs(line.c_str()); ofs << std::scientific << std::setprecision(40); write_code(ofs, data, line.c_str()); - + return 0; } diff --git a/tools/hypergeometric_1F1_error_plot.cpp b/tools/hypergeometric_1F1_error_plot.cpp index 649cd7bed..c9c1410b1 100644 --- a/tools/hypergeometric_1F1_error_plot.cpp +++ b/tools/hypergeometric_1F1_error_plot.cpp @@ -1,3 +1,7 @@ +// Copyright John Maddock 2006. +// 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) #define BOOST_ENABLE_ASSERT_HANDLER #define BOOST_MATH_MAX_SERIES_ITERATION_POLICY INT_MAX diff --git a/tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp b/tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp index 9655ddd57..ce1fe3255 100644 --- a/tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp +++ b/tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp @@ -1,3 +1,7 @@ +// Copyright John Maddock 2006. +// 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) #define BOOST_ENABLE_ASSERT_HANDLER #define BOOST_MATH_MAX_SERIES_ITERATION_POLICY INT_MAX diff --git a/tools/lambert_w_high_reference_values.cpp b/tools/lambert_w_high_reference_values.cpp index 3c908cc6e..11dd4306c 100644 --- a/tools/lambert_w_high_reference_values.cpp +++ b/tools/lambert_w_high_reference_values.cpp @@ -49,7 +49,7 @@ const int no_of_tests = 450; // 500 overflows float. static const float min_z = 0.5F; // for element[0] int main() -{ // Make C++ file containing Lambert W test values. +{ // Make C++ file containing Lambert W test values. std::cout << filename << " "; std::cout << std::endl; std::cout << "Lambert W0 decimal digit precision values for high z argument values." << std::endl; @@ -79,7 +79,7 @@ int main() "// Written by " << __FILE__ << " " << __TIMESTAMP__ << "\n" "\n" - "// Copyright Paul A. Bristow 2017." "\n" + "// Copyright Paul A. Bristow 2017." "\n" "// Distributed under the Boost Software License, Version 1.0." "\n" "// (See accompanying file LICENSE_1_0.txt" "\n" "// or copy at http://www.boost.org/LICENSE_1_0.txt)" "\n" diff --git a/tools/lambert_w_lookup_table_generator.cpp b/tools/lambert_w_lookup_table_generator.cpp index 7918e812f..8d4ebe1d0 100644 --- a/tools/lambert_w_lookup_table_generator.cpp +++ b/tools/lambert_w_lookup_table_generator.cpp @@ -9,15 +9,15 @@ //! to 34 decimal digits precision to cater for platforms that have 128-bit long double. //! The function bisection can then use any built-in floating-point type, //! which may have different precision and speed on different platforms. -//! The actual builtin floating-point type of the arrays is chosen by a +//! The actual builtin floating-point type of the arrays is chosen by a //! typedef in \modular-boost\libs\math\include\boost\math\special_functions\lambert_w.hpp -//! by default, for example: typedef double lookup_t; +//! by default, for example: typedef double lookup_t; // This includes lookup tables for both branches W0 and W-1. // Only W-1 is needed by current code that uses JM rational Polynomials, // but W0 is kept (for now) to allow comparison with the previous FKDVPB version -// that uses lookup for W0 branch as well as W-1. +// that uses lookup for W0 branch as well as W-1. #include #include // For exp_minus_one == 3.67879441171442321595523770161460867e-01. @@ -102,7 +102,7 @@ g: 0, 2.7182818284590452, 14.7781121978613, 60.256610769563003, 218.392600132576 5.2317811346197018e+28, 1.4450833904658542e+29, 3.9904954117194348e+29 -lambert_wm1 version of arrays from Fukushima +lambert_wm1 version of arrays from Fukushima e: 2.7182817459106445 7.3890557289123535 20.085535049438477 54.59814453125 148.41314697265625 403.42874145507813 1096.6329345703125 2980.957275390625 8103.08154296875 22026.458984375 59874.12109375 162754.734375 442413.21875 1202603.75 3269015.75 8886106 24154940 65659932 178482192 485164896 1318814848 3584910336 9744796672 26489102336 72004845568 195729457152 532047822848 1446255919104 3931331100672 10686465835008 29048824659968 78962889850880 214643389759488 583461240832000 1586012102852608 4311227773747200 11719131799748608 31855901283450880 86593318145753088 2.3538502982225101e+17 6.398428560008151e+17 1.7392731886358364e+18 4.7278345784949473e+18 1.2851586685678387e+19 3.493423319351296e+19 9.4961089747571704e+19 2.581309902546461e+20 7.0167278463083348e+20 1.9073443887231177e+21 5.1846992652160593e+21 1.4093473476000776e+22 3.831003235981371e+22 1.0413746376682761e+23 2.8307496154307266e+23 7.6947746628514896e+23 2.0916565667371597e+24 5.6857119515524837e+24 1.5455367020327599e+25 4.2012039964445827e+25 1.1420056438012293e+26 3.1042929865047826e+26 8.4383428037470738e+26 2.2937792813113457e+27 6.2351382164292627e+27 g: -0.36787945032119751 -0.27067059278488159 -0.14936122298240662 -0.073262564837932587 -0.033689741045236588 -0.014872515574097633 -0.0063831745646893978 -0.0026837014593183994 -0.0011106884339824319 -0.00045399941154755652 -0.00018371877376921475 -7.3730567237362266e-05 -2.9384291337919421e-05 -1.1641405762929935e-05 -4.5885362851549871e-06 -1.8005634956352878e-06 -7.0378973759943619e-07 -2.7413975089984888e-07 -1.0645318582191976e-07 -4.122309249510181e-08 -1.5923385277005764e-08 -6.1368328196920174e-09 -2.3602335641470518e-09 -9.0603280433754207e-10 -3.471987974901225e-10 -1.3283640853956058e-10 -5.0747316071575455e-11 -1.9360334516105304e-11 -7.3766357605586919e-12 -2.8072891233854591e-12 -1.0671687058344537e-12 -4.0525363013271809e-13 -1.5374336461045079e-13 -5.8272932648966574e-14 -2.206792725173521e-14 -8.3502896573240185e-15 -3.1572303958374423e-15 -1.192871523299666e-15 -4.5038112940094517e-16 -1.699343306816689e-16 -6.4078234365689933e-17 -2.4148019279880996e-17 -9.095073346605316e-18 -3.4237017961279004e-18 -1.2881348671140216e-18 -4.8440896082993503e-19 -1.8207810463107454e-19 -6.8407959442757565e-20 -2.569017156788846e-20 -9.6437611040447661e-21 -3.6186962678628536e-21 -1.357346940624028e-21 -5.0894276378983633e-22 -1.9076220526102576e-22 -7.1477077345829229e-23 -2.6773039821769189e-23 -1.0025130740057213e-23 -3.7527418826161672e-24 -1.4043593713279384e-24 -5.2539147015754201e-25 -1.9650207139502987e-25 -7.3474141096711539e-26 -2.7465588329293218e-26 -1.0264406957471058e-26 @@ -146,7 +146,7 @@ int main() int output_precision = std::numeric_limits::max_digits10; // 37 decimal digits. fout.precision(output_precision); fout << - "// Copyright Paul A. Bristow 2017." "\n" + "// Copyright Paul A. Bristow 2017." "\n" "// Distributed under the Boost Software License, Version 1.0." "\n" "// (See accompanying file LICENSE_1_0.txt" "\n" "// or copy at http://www.boost.org/LICENSE_1_0.txt)" "\n" @@ -157,7 +157,7 @@ int main() "// C++ floating-point precision is 128-bit long double.\n" "// Output as " << std::numeric_limits::max_digits10 - << " decimal digits, suffixed L.\n" + << " decimal digits, suffixed L.\n" "\n" "// C++ floating-point type is provided by lambert_w.hpp typedef." "\n" "// For example: typedef lookup_t double; (or float or long double)" "\n" @@ -179,7 +179,7 @@ int main() BOOST_STATIC_CONSTEXPR std::size_t noof_w0zs = 65; // F[k] 0 <= k <= 64. f[0] = F[0], f[64] = F[64] BOOST_STATIC_CONSTEXPR std::size_t noof_w0es = 66; // noof_w0zs +1 for gratuitous extra power. BOOST_STATIC_CONSTEXPR std::size_t noof_wm1zs = 64; // G[k] 1 <= k <= 64. (W-1 = 0 would be z = -infinity, so not stored in array) g[0] == G[1], g[63] = G[64] - BOOST_STATIC_CONSTEXPR std::size_t noof_wm1es = 64; // + BOOST_STATIC_CONSTEXPR std::size_t noof_wm1es = 64; // fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_w0es = " << noof_w0zs << ";" << std::endl; fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_w0zs = " << noof_w0zs << ";" << std::endl; @@ -204,7 +204,7 @@ int main() table_lookup_t ej = 1; // w0es[0] = e(); // e = 2.7182 exp(-1) - 1/e exp_minus_one = 0.36787944. w0es[1] = 1; // e^0 - w0zs[0] = 0; // F[0] = 0 or W0 branch. + w0zs[0] = 0; // F[0] = 0 or W0 branch. for (int j = 1, jj = 2; jj != noof_w0es; ++jj) { w0es[jj] = w0es[j] * exp_minus_one(); // previous * 0.36787944. @@ -212,13 +212,13 @@ int main() w0zs[j] = j * ej; // For W0 branch. j = jj; // Previous. } // for - } + } // Checks on accuracy of W0 exponents. // Checks on e power w0es // w0es[64] = 4.3596100000630809736231248158884615452e-28 - // N[e ^ -63, 37] = 4.359610000063080973623124815888459643×10^-28 + // N[e ^ -63, 37] = 4.359610000063080973623124815888459643*10^-28 // So slight loss at last decimal place. // Checks on accuracy of z for integral W0 w0zs @@ -228,7 +228,7 @@ int main() // w0zs[64] = 3.9904954117194348050619127737142022705e+29 // N[productlog(0, 3.9904954117194348050619127737142022705 10^+29), 37] // = 63.99999999999999999999999999999999547 - // = 64.0 to 34 decimal digits, so exact. :-) + // = 64.0 to 34 decimal digits, so exact. :-) { // z values for integral powers G[k] and e^-k for W-1 branch. // Fukushima indexing of G (k-1) differs by 1 from(k). @@ -236,10 +236,10 @@ int main() // and last is g[63] = G[64] = 1.026e-26 table_lookup_t e1 = 1. / e(); // 1/e = 0.36787944117144233 table_lookup_t ej = e1; - wm1es[0] = e(); // e = 2.7182 + wm1es[0] = e(); // e = 2.7182 wm1zs[0] = -e1; // -1/e = - 0.3678 for (int j = 0, jj = 1; jj != noof_wm1zs; ++jj) - { + { ej *= e1; // * 0.3678.. wm1es[jj] = wm1es[j] * e(); wm1zs[jj] = -(jj + 1) * ej; @@ -253,10 +253,10 @@ int main() // wm1es[0] = 2.7182818284590452353602874713526623144 - close enough. // N[e ^ 3, 37] 20.08553692318766774092852965458171790 // computed wm1es[2] 2.0085536923187667740928529654581712847e+01L OK - // e ^ 66 = 4.6071866343312915426773184428060086893349003037096040 × 10^28 + // e ^ 66 = 4.6071866343312915426773184428060086893349003037096040 * 10^28 // N[e ^ 66, 34] = 4.607186634331291542677318442806009 10^28 // computed 4.6071866343312915426773184428059867859e+28L - // N[e ^ 66, 37] = 4.607186634331291542677318442806008689×10^28 + // N[e ^ 66, 37] = 4.607186634331291542677318442806008689*10^28 // so suffering some loss of precision by repeated multiplication computation. // :-( @@ -264,10 +264,10 @@ int main() // 4.60718663433129154267731844280600868933490030370929982 // output std::cout.precision(std::numeric_limits::max_digits10) as 37 decimal digits. // 4.6071866343312915426773184428060086893e+28L - // N[e ^ 66, 37] = 4.607186634331291542677318442806008689×10^28 + // N[e ^ 66, 37] = 4.607186634331291542677318442806008689*10^28 // Agrees exactly for 37th place, so should be read in to nearest representable value. - + // Checks W-1 branch z values wm1zs // W-1[0] = -2.7067056647322538378799898994496883858e-01 // w-1[1] = -1.4936120510359182893802724695018536337e-01 @@ -277,13 +277,13 @@ int main() // N[productlog(-1, -1.4325445274604020119111357113179868158* 10^-27), 37] // = -65.99999999999999999999999999999999955 // = -66 accurately, so this is OK. - // z = 66 * e^66 = + // z = 66 * e^66 = // =N[-66*e ^ -66, 37] - // -1.432544527460402011911135711317986177×10^-27 + // -1.432544527460402011911135711317986177*10^-27 // wm1zs[65] -1.4325445274604020119111357113179868158e-27 // which agrees well enough to 34 decimal digits. // last wm1zs[65] = 0 is unused. - + // Halves, common to both W0 and W-1. halves[0] = static_cast(0.5); // Exactly representable. for (int j = 0; j != noof_sqrts -1; ++j) @@ -310,7 +310,7 @@ int main() fout << std::noshowpoint; // Do show NOT trailing zeros for halves and sqrts values. fout << - "\n" "BOOST_STATIC_CONSTEXPR lookup_t halves[noof_halves] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t halves[noof_halves] = " // "\n" "{ // Common to Lambert W0 and W-1 (and exactly representable)." << "\n "; for (int i = 0; i != noof_halves; i++) { @@ -327,7 +327,7 @@ int main() fout << "}; // halves, 0.5, 0.25, ... 0.000244140625, common to W0 and W-1." << std::endl; fout << - "\n" "BOOST_STATIC_CONSTEXPR lookup_t sqrtw0s[noof_sqrts] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t sqrtw0s[noof_sqrts] = " // "\n" "{ // For Lambert W0 only." << "\n "; for (int i = 0; i != noof_sqrts; i++) { @@ -344,7 +344,7 @@ int main() fout << "}; // sqrtw0s" << std::endl; fout << - "\n" "BOOST_STATIC_CONSTEXPR lookup_t sqrtwm1s[noof_sqrts] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t sqrtwm1s[noof_sqrts] = " // "\n" "{ // For Lambert W-1 only." << "\n "; for (int i = 0; i != noof_sqrts; i++) { @@ -362,14 +362,14 @@ int main() fout << std::scientific // May be needed to avoid very large dddddddddddddddd.ddddddddddddddd output? << std::showpoint; // Do show trailing zeros for sqrts and halves. - + // Two W0 arrays fout << // W0 e values. // Fukushima code generates an extra unused power, but it is not output by using noof_w0zs instead of noof_w0es. - "\n" "BOOST_STATIC_CONSTEXPR lookup_t w0es[noof_w0zs] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t w0es[noof_w0zs] = " // "\n" "{ // Fukushima e powers array e[0] = 2.718, 1., e[2] = e^-1 = 0.135, e[3] = e^-2 = 0.133 ... e[64] = 4.3596100000630809736231248158884615452e-28." << "\n "; - for (int i = 0; i != noof_w0zs; i++) + for (int i = 0; i != noof_w0zs; i++) { fout << w0es[i] << 'L'; if (i != noof_w0es - 1) @@ -384,7 +384,7 @@ int main() fout << "\n}; // w0es" << std::endl; fout << // W0 z values for W[1], . - "\n" "BOOST_STATIC_CONSTEXPR lookup_t w0zs[noof_w0zs] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t w0zs[noof_w0zs] = " // "\n" "{ // z values for W[0], W[1], W[2] ... W[64] (Fukushima array Fk). " << "\n "; for (int i = 0; i != noof_w0zs; i++) { @@ -403,7 +403,7 @@ int main() // Two arrays for w-1 fout << // W-1 e values. - "\n" "BOOST_STATIC_CONSTEXPR lookup_t wm1es[noof_wm1es] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t wm1es[noof_wm1es] = " // "\n" "{ // Fukushima e array e[0] = e^1 = 2.718, e[1] = e^2 = 7.39 ... e[64] = 4.60718e+28." << "\n "; for (int i = 0; i != noof_wm1es; i++) { @@ -420,7 +420,7 @@ int main() fout << "\n}; // wm1es" << std::endl; fout << // Wm1 z values for integral K. - "\n" "BOOST_STATIC_CONSTEXPR lookup_t wm1zs[noof_wm1zs] = " // + "\n" "BOOST_STATIC_CONSTEXPR lookup_t wm1zs[noof_wm1zs] = " // "\n" "{ // Fukushima G array of z values for integral K, (Fukushima Gk) g[0] (k = -1) = 1 ... g[64] = -1.0264389699511303e-26." << "\n "; for (int i = 0; i != noof_wm1zs; i++) { @@ -453,7 +453,7 @@ Original arrays as output by Veberic/Fukushima code: w0 branch -W-1 branch +W-1 branch e: 2.7182818284590451 7.3890560989306495 20.085536923187664 54.598150033144229 148.41315910257657 403.42879349273500 1096.6331584284583 2980.9579870417274 8103.0839275753815 22026.465794806707 59874.141715197788 162754.79141900383 442413.39200892020 1202604.2841647759 3269017.3724721079 8886110.5205078647 24154952.753575277 65659969.137330450 178482300.96318710 485165195.40978980 1318815734.4832134 3584912846.1315880 9744803446.2488918 26489122129.843441 72004899337.385788 195729609428.83853 532048240601.79797 1446257064291.4734 3931334297144.0371 10686474581524.447 29048849665247.383 78962960182680.578 214643579785915.75 583461742527454.00 1586013452313428.3 4311231547115188.5 11719142372802592. 31855931757113704. 86593400423993600. 2.3538526683701958e+17 6.3984349353005389e+17 1.7392749415204982e+18 4.7278394682293381e+18 1.2851600114359284e+19 3.4934271057485025e+19 9.4961194206024286e+19 2.5813128861900616e+20 7.0167359120976157e+20 1.9073465724950953e+21 5.1847055285870605e+21 1.4093490824269355e+22 3.8310080007165677e+22 1.0413759433029062e+23 2.8307533032746866e+23 7.6947852651419974e+23 2.0916594960129907e+24 5.6857199993359170e+24 1.5455389355900996e+25 4.2012104037905024e+25 1.1420073898156810e+26 3.1042979357019109e+26 8.4383566687414291e+26 2.2937831594696028e+27 6.2351490808115970e+27 diff --git a/tools/lambert_w_low_reference_values.cpp b/tools/lambert_w_low_reference_values.cpp index 0c0a0f72d..177c65005 100644 --- a/tools/lambert_w_low_reference_values.cpp +++ b/tools/lambert_w_low_reference_values.cpp @@ -7,7 +7,7 @@ // Write a C++ file J:\Cpp\Misc\lambert_w_1000_test_values\lambert_w_mp_values.ipp // containing arrays of z arguments and 100 decimal digit precision lambert_w0(z) reference values. -// These can be used in tests of precision of less-precise types like +// These can be used in tests of precision of less-precise types like // built-in float, double, long double and quad and cpp_dec_float_50. // Multiprecision types: @@ -15,7 +15,7 @@ #include // boost::multiprecision::cpp_dec_float_100 using boost::multiprecision::cpp_dec_float_100; -#include // +#include // using boost::math::lambert_w0; #include @@ -88,11 +88,11 @@ void init_ws() // Global so accessible from output_value. // Creates if no file exists, & uses default overwrite/ ios::replace. -const char filename[] = "lambert_w_low_reference values.ipp"; // -std::ofstream fout(filename, std::ios::out); ; // +const char filename[] = "lambert_w_low_reference values.ipp"; // +std::ofstream fout(filename, std::ios::out); ; // // 100 decimal digits for the value fed to macro BOOST_MATH_TEST_VALUE -typedef cpp_dec_float_100 RealType; +typedef cpp_dec_float_100 RealType; void output_value(size_t index, RealType value) { @@ -115,7 +115,7 @@ void output_lambert_w0(size_t index, RealType value) } int main() -{ // Make C++ file containing Lambert W test values. +{ // Make C++ file containing Lambert W test values. std::cout << filename << " "; #ifdef __TIMESTAMP__ std::cout << __TIMESTAMP__; @@ -124,7 +124,7 @@ int main() std::cout << "Lambert W0 decimal digit precision values." << std::endl; // Note __FILE__ & __TIMESTAMP__ are ANSI standard C & thus Std C++? - + if (!fout.is_open()) { // File failed to open OK. std::cerr << "Open file " << filename << " failed!" << std::endl; @@ -133,7 +133,7 @@ int main() } int output_precision = std::numeric_limits::digits10; - // cpp_dec_float_100 is ample precision and + // cpp_dec_float_100 is ample precision and // has several extra bits internally so max_digits10 are not needed. fout.precision(output_precision); @@ -150,7 +150,7 @@ int main() "// Written by " << __FILE__ << " " << __TIMESTAMP__ << "\n" "\n" - "// Copyright Paul A. Bristow 2017." "\n" + "// Copyright Paul A. Bristow 2017." "\n" "// Distributed under the Boost Software License, Version 1.0." "\n" "// (See accompanying file LICENSE_1_0.txt" "\n" "// or copy at http://www.boost.org/LICENSE_1_0.txt)" "\n" @@ -158,7 +158,7 @@ int main() fout << "// Size of arrays of arguments z and Lambert W" << std::endl; fout << "static const unsigned int noof_tests = " << no_of_tests << ";" << std::endl; - + // Declare arrays of z and Lambert W. fout << "// Declare arrays of arguments z and Lambert W(z)" << std::endl; @@ -185,7 +185,7 @@ int main() size_t step_count = no_of_tests; // Output to initialize array of arguments z for Lambert W. - fout << + fout << "\n" << "template \n" "void init_zs()\n" @@ -198,7 +198,7 @@ int main() z += step_size; } fout << "};" << std::endl; - + // Output array of Lambert W values. fout << "\n" @@ -213,7 +213,7 @@ int main() z += step_size; } fout << "};" << std::endl; - + fout << "// End of lambert_w_mp_values.ipp " << std::endl; fout.close();