Edits to satisfy the picky inspect.exe program, now passing local tests using MSVC 14.2, except for six cpp_int*serial*.txt testdata files missing licence.

This commit is contained in:
pabristow
2019-08-14 18:02:10 +01:00
parent 4336139112
commit 86a7142d96
32 changed files with 180 additions and 110 deletions

View File

@@ -1,7 +1,7 @@
@import url('../../../../doc/src/boostbook.css');
/* Contains the basic settings for BoostBook and used by Quickbook to docbook conversion.
location is BOOST_ROOT/doc/src/boostbook.css.
*/
/* Contains the basic settings for BoostBook and used by Quickbook to docbook conversion. */
/* Note:this import link assumes called from doc/html, not from any backup copy in /doc. */
/*=============================================================================
Copyright (c) 2004 Joel de Guzman http://spirit.sourceforge.net/
@@ -18,6 +18,10 @@ 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 to avoid error message from inspect.exe
doc\multiprecision.css: Unlinked file
(line 1) Broken link: ../../../../doc/src/boostbook.css
/*=============================================================================
Program listings
@@ -151,10 +155,10 @@ span.gray { color: #808080; } /* light gray */
*/
span.serif_italic {
font-family: serif;
font-style: italic;
font-size: 125%;
font-stretch: expanded;
font-family: serif;
font-style: italic;
font-size: 125%;
font-stretch: expanded;
}
/* Custom indent of paragraphs to make equations look nicer, 2% to match that indent of code block above.
@@ -162,9 +166,9 @@ https://www.w3schools.com/tags/tag_blockquote.asp says
"Most browsers will display the <blockquote> element with left and right margin 40px values: "
*/
blockquote {
display: block;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 2%;
margin-right: 2%;
display: block;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 2%;
margin-right: 2%;
}

View File

@@ -1,5 +1,7 @@
@import url('../../../../doc/src/boostbook.css');
/* Contains the basic settings for BoostBook and used by Quickbook to docbook conversion. */
/* Contains the basic settings for BoostBook and used by Quickbook to docbook conversion. */
/* Note:this import link assumes called from doc/html, not from any backup copy in /doc. */
/*=============================================================================
Copyright (c) 2004 Joel de Guzman http://spirit.sourceforge.net/
@@ -16,6 +18,10 @@ 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 to avoid error message from inspect.exe
doc\multiprecision.css: Unlinked file
(line 1) Broken link: ../../../../doc/src/boostbook.css
/*=============================================================================
Program listings

View File

@@ -2973,9 +2973,14 @@ To use these `#include <boost/math/tools/precision.hpp>`.
[h5:FP_tolerance Tolerance for Floating-point Comparisons]
`epsilon` is very useful to compute a tolerance when comparing floating-point values,
[@https://en.wikipedia.org/wiki/Machine_epsilon Machine epsilon [epsilon]]
is very useful to compute a tolerance when comparing floating-point values,
a much more difficult task than is commonly imagined.
The C++ standard specifies [@https://en.cppreference.com/w/cpp/types/numeric_limits/epsilon `std::numeric_limits<>::epsilon()`]
and Boost.Multiprecision implements this (where possible) for its program-defined types analogous to the
__fundamental floating-point types like `double` `float`.
For more information than you probably want (but still need) see
[@http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html What Every Computer Scientist Should Know About Floating-Point Arithmetic]
@@ -3000,7 +3005,7 @@ See also:
[tolerance_1]
used thus:
cd ./test
BOOST_CHECK_CLOSE_FRACTION(expected, calculated, tolerance);
(There is also a version BOOST_CHECK_CLOSE using tolerance as a [*percentage] rather than a fraction;

View File

@@ -9,6 +9,8 @@
#include <vector>
#include <iterator>
// Contains Quickbook snippets in comments.
//[IE2
/*`
@@ -40,7 +42,7 @@ int main()
import_bits(i, v.begin(), v.end());
cpp_bin_float_100 g(i);
g.backend().exponent() = e;
assert(f == g);
BOOST_ASSERT(f == g);
}
//]

View File

@@ -12,7 +12,7 @@
//[IE1
/*`
In this simple example, we'll import/export the bits of a cpp_int
In this simple example, we'll import/export the bits of a cpp_int
to a vector of 8-bit unsigned values:
*/
/*=
@@ -37,7 +37,7 @@ int main()
// import back again, and check for equality:
cpp_int j;
import_bits(j, v.begin(), v.end());
assert(i == j);
BOOST_ASSERT(i == j);
}
//]

View File

@@ -1,3 +1,10 @@
// Copyright Nick Thompson, 2017
// Copyright John Maddock 2017
// 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 <cmath>
#include <cstdint>
#include <functional>

View File

@@ -8,6 +8,8 @@
#include <iomanip>
#include <vector>
// Includes Quickbook code snippets as comments.
//[FAC1
/*`
@@ -28,13 +30,13 @@ void print_factorials()
//
// Print all the factorials that will fit inside a 128-bit integer.
//
// Begin by building a big table of factorials, once we know just how
// Begin by building a big table of factorials, once we know just how
// large the largest is, we'll be able to "pretty format" the results.
//
// Calculate the largest number that will fit inside 128 bits, we could
// also have used numeric_limits<int128_t>::max() for this value:
cpp_int limit = (cpp_int(1) << 128) - 1;
//
//
// Our table of values:
std::vector<cpp_int> results;
//
@@ -56,7 +58,7 @@ void print_factorials()
// Now print them out, using right justification, while we're at it
// we'll indicate the limit of each integer type, so begin by defining
// the limits for 16, 32, 64 etc bit integers:
cpp_int limits[] = {
cpp_int limits[] = {
(cpp_int(1) << 16) - 1,
(cpp_int(1) << 32) - 1,
(cpp_int(1) << 64) - 1,
@@ -115,7 +117,7 @@ The output from this routine is:
8222838654177922817725562880000000
263130836933693530167218012160000000
8683317618811886495518194401280000000
295232799039604140847618609643520000000
295232799039604140847618609643520000000
]
*/
@@ -123,8 +125,8 @@ The output from this routine is:
//[BITOPS
/*`
In this example we'll show how individual bits within an integer may be manipulated,
/*`
In this example we'll show how individual bits within an integer may be manipulated,
we'll start with an often needed calculation of ['2[super n] - 1], which we could obviously
implement like this:
*/
@@ -162,12 +164,12 @@ which we can then simply decrement. The result from a call to `b2` is the same
We can equally test bits, so for example the n'th bit of the result returned from `b2` shouldn't be set
unless we increment it first:
assert(!bit_test(b1(200), 200)); // OK
assert(bit_test(++b1(200), 200)); // OK
BOOST_ASSERT(!bit_test(b1(200), 200)); // OK
BOOST_ASSERT(bit_test(++b1(200), 200)); // OK
And of course if we flip the n'th bit after increment, then we should get back to zero:
assert(!bit_flip(++b1(200), 200)); // OK
BOOST_ASSERT(!bit_flip(++b1(200), 200)); // OK
*/
//]
@@ -178,9 +180,9 @@ int main()
std::cout << std::hex << std::showbase << b1(200) << std::endl;
std::cout << std::hex << std::showbase << b2(200) << std::endl;
assert(!bit_test(b1(200), 200)); // OK
assert(bit_test(++b1(200), 200)); // OK
assert(!bit_flip(++b1(200), 200)); // OK
BOOST_ASSERT(!bit_test(b1(200), 200)); // OK
BOOST_ASSERT(bit_test(++b1(200), 200)); // OK
BOOST_ASSERT(!bit_flip(++b1(200), 200)); // OK
return 0;
}
@@ -224,7 +226,7 @@ Program output:
8222838654177922817725562880000000
263130836933693530167218012160000000
8683317618811886495518194401280000000
295232799039604140847618609643520000000
295232799039604140847618609643520000000
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
*/

View File

@@ -5,13 +5,13 @@
//[mpfr_variable
/*`
/*`
This example illustrates the use of variable-precision arithmetic with
the `mpfr_float` number type. We'll calculate the median of the
beta distribution to an absurdly high precision and compare the
accuracy and times taken for various methods. That is, we want
to calculate the value of `x` for which ['I[sub x](a, b) = 0.5].
Ultimately we'll use Newtons method and set the precision of
mpfr_float to have just enough digits at each iteration.
@@ -110,7 +110,7 @@ full working precision of the arguments throughout. Our reference function take
We begin by setting the default working precision to that requested, and then, since we don't know where
our arguments `a` and `b` have been or what precision they have, we make a copy of them - note that since
copying also copies the precision as well as the value, we have to set the precision expicitly with a
copying also copies the precision as well as the value, we have to set the precision expicitly with a
second argument to the copy. Then we can simply return the result of `ibeta_inv`:
*/
mpfr_float beta_distribution_median_method_1(mpfr_float const& a_, mpfr_float const& b_, unsigned digits10)
@@ -167,9 +167,9 @@ Method 2 time = 0.646746
Relative error: 7.55843e-1501
]
Clearly they are both equally accurate, but Method 1 is actually faster and our plan for improved performance
Clearly they are both equally accurate, but Method 1 is actually faster and our plan for improved performance
hasn't actually worked. It turns out that we're not actually comparing like with like, because `ibeta_inv` uses
Halley iteration internally which churns out more digits of precision rather more rapidly than Newton iteration.
Halley iteration internally which churns out more digits of precision rather more rapidly than Newton iteration.
So the time we save by refining an initial `double` approximation, then loose it again by taking more iterations
to get to the result.
@@ -188,7 +188,7 @@ mpfr_float beta_distribution_median_method_3(mpfr_float const& a_, mpfr_float co
while (current_digits < digits10)
{
current_digits *= 2;
scoped_precision sp(std::min(current_digits, digits10));
scoped_precision sp((std::min)(current_digits, digits10));
mpfr_float a(a_, mpfr_float::default_precision()), b(b_, mpfr_float::default_precision());
guess.precision(mpfr_float::default_precision());
f = boost::math::detail::ibeta_imp(a, b, guess, boost::math::policies::policy<>(), false, true, &f1) - 0.5f;

View File

@@ -31,7 +31,7 @@
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp> // Boost.Test
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/floating_point_comparison.hpp>
static long double const log10Two = 0.30102999566398119521373889472449L; // log10(2.)
@@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(test_numeric_limits_snips)
// No max_digits10 implemented.
std::cout.precision(max_digits10<T>());
#else
#if(_MSC_VER <= 1600)
#if(_MSC_VER <= 1600)
// Wrong value for std::numeric_limits<float>::max_digits10.
std::cout.precision(max_digits10<T>());
#else // Use the C++11 max_digits10.
@@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(test_numeric_limits_snips)
typedef double T;
bool denorm = std::numeric_limits<T>::denorm_min() < std::numeric_limits<T>::min();
bool denorm = std::numeric_limits<T>::denorm_min() < (std::numeric_limits<T>::min)();
BOOST_ASSERT(denorm);
//] [/max_digits10_6]
@@ -425,10 +425,10 @@ Then we can equally well use a multiprecision type cpp_bin_float_quad:
ss.imbue(new_locale);
T inf = std::numeric_limits<T>::infinity();
ss << inf; // Write out.
assert(ss.str() == "inf");
BOOST_ASSERT(ss.str() == "inf");
T r;
ss >> r; // Read back in.
assert(inf == r); // Confirms that the floating-point values really are identical.
BOOST_ASSERT(inf == r); // Confirms that the floating-point values really are identical.
std::cout << "infinity output was " << ss.str() << std::endl;
std::cout << "infinity input was " << r << std::endl;
}
@@ -448,7 +448,7 @@ Similarly we can do the same with NaN (except that we cannot use `assert`)
T n;
T NaN = std::numeric_limits<T>::quiet_NaN();
ss << NaN; // Write out.
assert(ss.str() == "nan");
BOOST_ASSERT(ss.str() == "nan");
std::cout << "NaN output was " << ss.str() << std::endl;
ss >> n; // Read back in.
std::cout << "NaN input was " << n << std::endl;

View File

@@ -62,7 +62,7 @@ struct logged_adaptor
m_value = o.m_value;
log_postfix_event(m_value, "Copy construct");
}
#ifndef BOOST_NO_RVALUE_REFERENCES
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
logged_adaptor(logged_adaptor&& o)
{
log_prefix_event(m_value, o.value(), "Move construct");

View File

@@ -1114,7 +1114,7 @@ inline void assign_components(mpc_complex_backend<D1>& result, const mpfr_float_
//
if (!D1)
{
unsigned long prec = std::max(mpfr_get_prec(a.data()), mpfr_get_prec(b.data()));
unsigned long prec = (std::max)(mpfr_get_prec(a.data()), mpfr_get_prec(b.data()));
mpc_set_prec(result.data(), prec);
}
using default_ops::eval_fpclassify;

View File

@@ -1,3 +1,7 @@
// Copyright 2018 John Maddock. 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)
#include <boost/multiprecision/cpp_bin_float.hpp>
#include <boost/math/special_functions.hpp>
#include <boost/chrono.hpp>

View File

@@ -49,4 +49,4 @@ int main()
return 0;
}
#endif
#endif

View File

@@ -222,7 +222,7 @@ void example10()
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl;
cout << "a.min(a.abs().sqrt()) =" << endl
<< a.min(a.abs().sqrt()) << endl;
<< (a.min)(a.abs().sqrt()) << endl;
}
template <class Num>

View File

@@ -23,38 +23,38 @@ boost::multiprecision::cpp_rational rationalfromStr2(const char* str)
int main()
{
// this example is OK
// This example is OK.
{
boost::multiprecision::cpp_rational expected = 1;
assert(expected == rationalfromStr("1"));
BOOST_ASSERT(expected == rationalfromStr("1"));
}
// this example is OK
// This example is OK.
{
boost::multiprecision::cpp_rational expected = boost::multiprecision::cpp_rational(25) / boost::multiprecision::cpp_rational(10);
assert(expected == rationalfromStr("2.5"));
BOOST_ASSERT(expected == rationalfromStr("2.5"));
}
// this example is OK
// This example is OK.
{
boost::multiprecision::cpp_rational expected = boost::multiprecision::cpp_rational(5) / boost::multiprecision::cpp_rational(1000);
assert(expected == rationalfromStr("0.005"));
BOOST_ASSERT(expected == rationalfromStr("0.005"));
}
// this example is OK
// This example is OK.
{
boost::multiprecision::cpp_rational expected = 0;
assert(expected == boost::multiprecision::cpp_rational("0")); // direct cpp_rational from str is ok
BOOST_ASSERT(expected == boost::multiprecision::cpp_rational("0")); // direct cpp_rational from str is OK.
}
// this example fails
// This example fails.
{
boost::multiprecision::cpp_rational expected = 0;
// reacheble code
assert(expected == rationalfromStr("0")); // cpp_rational from cpp_dec_float_50 is not ok
// unreacheble code
// reachable code
BOOST_ASSERT(expected == rationalfromStr("0")); // cpp_rational from cpp_dec_float_50 is not OK.
// unreachable code
}
{
boost::multiprecision::cpp_rational expected = 0;
// reacheble code
assert(expected == rationalfromStr2("0")); // cpp_rational from cpp_dec_float_50 is not ok
// unreacheble code
BOOST_ASSERT(expected == rationalfromStr2("0")); // cpp_rational from cpp_dec_float_50 is not OK.
// unreachable code
}
return 0;
}

View File

@@ -1,3 +1,8 @@
// Copyright 2016 John Maddock. 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)
static const boost::array<boost::array<typename table_type<T>::type, 3>, 500> gamma = {{{SC_(8.45530509948730468750000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01), SC_(1.11676792084632275714192215809847832812560655161416701540037514678588899552795223636051283861515685855053582939146274240113874531527973814210488207830128530900559599074170389066138081891070712920623473461857632254352617595899153121789055651865429663273105801624222067275035146160407682419814612559770937851333313258174693831239060158272144283644033402005812336141640353704703451805075743457651474500575180336149704581761302422616802534269713673320145810616702623379426577267381016596640646036780085640e+00), SC_(1.10438728442867816609665916944098399086765601795314917615577669041382221945245269046345957164829024229823010663264720601624809651655116368339246859099278886577422386896811750937967494940960029250224075543433744666205413027910764506859493838993507216401131983731121529344952082060498119577899781093069658373786189150246027769179901839580061229387653730476486565832292623869480613925012343335744507187985817127088673548820437219886661135524261767270766239756270078148544872782377812888609878714473093021e-01)},
{SC_(1.39026832580566406250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00), SC_(8.87837246534584512058304626597150000489120292563756272246130863589440629431328166236343343023478965830481648988944668013833863592688512739847732271129409060356695212103238739655240822053671736250775878014127604440817225103010320322756075484745769185701456653223475749864397685319786785385530182719007531303116138466452735235078861018575437520732342354574967183308070807923233032727588780923086501266291147367564653286869648484915713961300281876539970618140056759819325004245961660980554836491213594461e-01), SC_(-1.18966833717491030777529019926331960352855377707641323046275606078389124027926611789911603150540144713683748681801863772072067302459578683018790819197528173413969356904557087663396842789779718125888832504274452988602707088024742817513733531775897173110489239191365127876847654130551501903438865671258532679739640203442463217240189322306203147786367096739239036281487648421042118138143391813517167916949838797835701356844050619004326570975617904601257077440910867376277877219954044806432791089137635152e-01)},
{SC_(1.43504619598388671875000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00), SC_(8.85908592055477020544823146996462988920753671462990877927427523793784391636857990149923096368122868020391764231333911220440936193158035215379333873738823239728773696032128851923243880532734156757960723683643045365212843713096041451134263420009087064362953191913886157628325070283143368675406959711653730415068180223485945836948634468821206791379329892575297995361852566312748126836116054701645545213593209611892028096694432232545135202461301088136703343459844999000604508302338782169984763967607501314e-01), SC_(-1.21141502936978554470331924245181844536653300286225422140798757837139525637498346623087068230762388958190805297179369893104223420947821790937027145400844138709085611406641604698885150056395888192847451388558341660380510005326476801210828545697252686002267491495285666799318711798085628503140489815338199728719860874280450505965277773655528536902886328052951994398070322644031431224912585052114632613788261969630244977993915035447500319483308338977079266591371885961850522890584558525442875774358053017e-01)},

View File

@@ -1,3 +1,7 @@
// Copyright 2016 John Maddock. 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)
static const boost::array<boost::array<typename table_type<T>::type, 3>, 101> gamma_0 = {{{SC_(1.43156441636360688183664865448643158739330056363229723426222506077465368434786796569824218750000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-30), SC_(6.98536502143685108617882284090181520784225065279944459321343460310063824042105596746205061501871754388692206421700826292338586923926227628460021980992867287987375102820871203483062060697666614954318393354992686094982543110966849877446263308176165064356911280715433887048666237697473022869255273999217684089964991492221986910024913642477585922789463545534969256995761341961043378489622694491092689099559034124245255841747358458264103951568451574298386270253381902108950381976482928860300454676297330631e+29), SC_(6.87187849460716195307241085972306257332085866067179593404732520056618176287191986920381800623266452019036583359883694184875415202170061110761480957915606961682069515921066423464205321804055901215315467103669400564886703708251292818882278221076111306170866005908677608207802396451776607673326647945821489765973119269856654977100758235960633379767322574933089743488018675093572248899118887185116534963011794036363538903828089102456817460307090409752243309227015705466471210473582150215759294410478127318e+01)},
{SC_(1.79146693234808763489644628257161121326585477954787539722758538118796423077583312988281250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-30), SC_(5.58201763003960861567789539135859580193439485454005702914698335930268444742331582630745213615777247085201364155083693868300803234678816291383457578463565723759685983298265642045770249117431149944641399014596592494299731209900651334858910291525879151363330828856538879949073338110312308363596227316892822743368020808448586000291704754174750156554217552056937856371791137981786534012294619836443861840926728414921766784846846305707429974243911452854519547303013841568504048941438592827646572038542434135e+29), SC_(6.84945179903097403861349744215875103992060757962123025404796608423978602225846553619170965077356955755357802672163974219562277828210284327971512344158362567867847738326049609853308815256769082679556958330239424646993080494046302980172303736275513780193302833410723002758066285468945113082751363817936859921002909109039191137803314698577973722031573009127625727285778678734025455705063199556191858178447008447936782744160858096688591534358039500459582424936993394926936663017800067374964851005923319757e+01)},
{SC_(6.01361845021915553684662812684153866129482788357822620195491936101461760699748992919921875000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-30), SC_(1.66289233059599382108622045278925250222879368299965805063800397354768670022530740489524286087023172081743657291575193949292317670513431375657893264047630789615214924106176337174346019293635258374337002078109120613262494521256415816444259140590129490551962102684902275473895987026116781659018530303429482685495372173326818893646289757008674753758860465244922365484215329043013694653249383965600156071526093224196543564395256619974579165365709216420397501003922915691506013990491427372931318956493080999e+29), SC_(6.72835261508627487441809388914618718039806766838076765738449388127304650638500226155393279449547157554874214601262165687120232963516589317117744273330309623400314525833549943284641956342219602925993192470847874648719472012633435814459477730435577468888682456785797630097073380249832077254791664762750315685378649126380990575187276250739357550980693771790622800409807477947479455730830600697505092486997466317766437101841783321172164072094610651193846740792964214770153922331926924938123871030133738925e+01)},

View File

@@ -1,3 +1,7 @@
// Copyright 2016 John Maddock. 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)
static const boost::array<boost::array<typename table_type<T>::type, 3>, 42> gamma_1_2 = {{{SC_(1.00000143051147460937500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00), SC_(9.99999174288391999092757871949960760944599692334161113632612001448234829888352099654097074654344285708898686038400924243326257000995473599459860412189476206535957778861551088462375468578938240500307167618043731787467573306745319965463132052615688418631316435531309275145303892395341676733095522386701856522207240447267708668301329563326443831046210450368179263405643106444973478994275343456845976754204700528622443064906871609264433329448562184863557194334628845647631027980086626707202034219860132039e-01), SC_(-8.25711948900924692597299306183832574130326734078524848537366321722804959189414089321374321487571322916700881394838168937675017756067526027059906924659380618507813551107141661082752510377407448366888067712646753094821383103251070103298799663269077425948810538745741157050557462080083874347930605957984000258314264095908394093097201357665227991167061298266665567091332898437498972810629979744483195488186797207794753595348181654435055140261537588799716884603608921499148980999953580901141143177940912987e-07)},
{SC_(1.00000190734863281250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00), SC_(9.99998899052088870556298015139749114669312651159953142848295392815303317500016029969635974482718991700497816055817263571292901954688370348906253549005287861083171410201406647883485474421222649893000205148346129113166971062186410799748091336730057656052509954292585979817626028277775407407112537788176094920236533009104994139384430523864665582176691381647483160502797293814016280767994802120063648051546796192887146643586658388925305855542153022171696856252158767172309183370455258068376853535216362470e-01), SC_(-1.10094851717304002712268894099127595921487972573933586334689334527229248323934919014638550108524145553527405840273344353639000207218741487766297554573091476469480049905558271838458052416000410785954618163762239772914309942293307957081996934083616872743593791436745000684254951241300456576383726667911197040993317728453157236842228209877681100498209542136619826560930165076125847234456840374995616717759747291279589613997037378064178672114262185168274084948288257929977168303768505416039428474173888808e-06)},
{SC_(1.00000715255737304687500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00), SC_(9.99995871482439030123562974470516145713394424812766636877383802416011979320279049083203112581733456099995683282738209665836532102308697025612534875128891666457345958520964130243018916433692201391748875528601051438277602513487355536872792386028259758535373151611332556663150738220804194424251848920431250539383936484964316068698893034940814586752406503829065074575875145977149630424770495659102034695665964258237898580634499483188073724936730054003089085359012125236558137262535083336056587140852800456e-01), SC_(-4.12852608332195851691203735959218082583309360270436920767851544796916430110170536266576060329474456009336058048427569309546294249770163912414335808655484082224000396074276450271816190829739395101572464054265620776265007334847480163917450671956548131916218767194273440313568874946498741895154818277265159531908173961864655218297464043731661102093299016819229971909322404880656592327408588191219928932127624518196151869557514361114934732089059682453199895851884381325844177861206907545771018319777526395e-06)},

View File

@@ -1,3 +1,7 @@
// Copyright 2016 John Maddock. 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)
static const boost::array<boost::array<typename table_type<T>::type, 3>, 37> gamma_neg = {{{SC_(-1.99999923706054687500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+01), SC_(5.38759967029644469616560016595808625878165115132471799422204595092834392971724800295938555800538579100535589193822651301525500332693249993444773179507605929981356967101597471714913951503842754010685235605590797063810809157738833492835143542871035345598564520502417261905785944669205716043072390494373490322257034881967960644010974493437512042261352756680026670684484992045553462469360277775982744564680091587106757967345008672070319207656022615608926133979854875552214891487061214012912806431933345947e-14), SC_(-3.05520913463708585014455473559668296916495608452525817143535406097314334283489713736687704477991497991743275712369308074041840740834063476031830765479882984731724892451179592298597321676916458283977757781247413334326383052593649852562076019260959425621178055912343813003433354826966649421695320908213626776555336215272482327946648668250227228003910957432402159538084527454011770143934418513330640797665570919946502860682207966694798401992754387345165102379010439953671041677549784758078058910327404016e+01)},
{SC_(-1.99999847412109375000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+01), SC_(2.69386191462138420561447561038626224725117398415048907272463757295904788742894427112020961644079599036497975583044564125160703746233180407160915929733564532906838635276687410781434210968261046929963453818364947812836593421630201317463294954608503146564867836821695405794382366118304227852763276692341615826262038036617817133464411475558985554970017557556048465581312483241407482874644374899521475569917118996299966475968950890235428728201297431223495619259559376314387803604742172470399752300894010086e-14), SC_(-3.12452154818785908505194845842029487392648620731103347207456198557211206269365761877112968634636619292832400844203780475198066901590319174974134489763347121929467737468999532787760555110439805900327811331337512388862249634034030061740800094556846919604832510099987981577497784616554033244322463034054231121064946938163159446958559684540678853656682058592193991149452718861454400627271395975031543423753488544502623725092389101829686729006797143129176563509552320320921307398500613227697762154498835511e+01)},
{SC_(-1.99999389648437500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+01), SC_(6.73558608044741627613413161420894656660058244124013446415180740530561515977792519827786858298784888263741224694297801215204067458618582387642758104711087267937066115855571693609659647797364715279501851796768712301165273782031584039675949865273825182234792801200308929645339256017900697087444360181691659499183064954028133244891427139092630423281589186925295403769367835997750592932795632852612041064703694287432540499377174363368787259684826128422805916075141721701587432972834880653382078107215883569e-15), SC_(-3.26313715687234132229989418098489729669001773722991796067366352789851953766781785355780461541281354995935763718291948133987534108182481755843147601008349939129025054962326064655846767144347454369030917012611615739585725945726636841524124521503115786360787497866575048827515382394272660988449740261822693490509884264357425735902873622582534393835987530480698916877954377750564674591032227255165999311213894591898118964168841058394282558238633558154941771511534821685892908044060408931199226908086343943e+01)},

View File

@@ -1,3 +1,7 @@
These tests are designed to test Boost.Math's code at really rather high precision
- 500 decimal digits or so. As such they use their own test data, and take rather
a long time to run.
These tests are designed to test Boost.Math's code at really rather high precision - 500 decimal digits or so.
As such they use their own test data, and take rather a long time to run.
// Copyright 2016 John Maddock. 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)

View File

@@ -5,3 +5,8 @@ different code inside the Math lib. We don't test at very high precision here a
Boost.Math's test data doesn't go much beyond 35 digits (for good reason, some compilers
choke when attempting to parse higher precision numbers as double's).
// Copyright 2018 John Maddock. 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)

View File

@@ -1,3 +1,8 @@
// 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)
#ifndef SC_
#define SC_(x) static_cast<T>(BOOST_STRINGIZE(x))
#endif

View File

@@ -2623,34 +2623,36 @@ test_relationals(T a, T b)
// min and max overloads:
//
#if !defined(min) && !defined(max)
using std::max;
using std::min;
// using std::max;
// using std::min;
// This works, but still causes complaints from inspect.exe, so use brackets to prevent macrosubstitution,
// and to explicitly specify type T seems necessary, for reasons unclear.
a = 2;
b = 5;
c = 6;
BOOST_CHECK_EQUAL(min(a, b), a);
BOOST_CHECK_EQUAL(min(b, a), a);
BOOST_CHECK_EQUAL(max(a, b), b);
BOOST_CHECK_EQUAL(max(b, a), b);
BOOST_CHECK_EQUAL(min(a, b + c), a);
BOOST_CHECK_EQUAL(min(b + c, a), a);
BOOST_CHECK_EQUAL(min(a, c - b), 1);
BOOST_CHECK_EQUAL(min(c - b, a), 1);
BOOST_CHECK_EQUAL(max(a, b + c), 11);
BOOST_CHECK_EQUAL(max(b + c, a), 11);
BOOST_CHECK_EQUAL(max(a, c - b), a);
BOOST_CHECK_EQUAL(max(c - b, a), a);
BOOST_CHECK_EQUAL(min(a + b, b + c), 7);
BOOST_CHECK_EQUAL(min(b + c, a + b), 7);
BOOST_CHECK_EQUAL(max(a + b, b + c), 11);
BOOST_CHECK_EQUAL(max(b + c, a + b), 11);
BOOST_CHECK_EQUAL(min(a + b, c - a), 4);
BOOST_CHECK_EQUAL(min(c - a, a + b), 4);
BOOST_CHECK_EQUAL(max(a + b, c - a), 7);
BOOST_CHECK_EQUAL(max(c - a, a + b), 7);
BOOST_CHECK_EQUAL( (std::min<T>)(a, b), a);
BOOST_CHECK_EQUAL( (std::min<T>)(b, a), a);
BOOST_CHECK_EQUAL( (std::max<T>)(a, b), b);
BOOST_CHECK_EQUAL( (std::max<T>)(b, a), b);
BOOST_CHECK_EQUAL( (std::min<T>)(a, b + c), a);
BOOST_CHECK_EQUAL( (std::min<T>)(b + c, a), a);
BOOST_CHECK_EQUAL( (std::min<T>)(a, c - b), 1);
BOOST_CHECK_EQUAL( (std::min<T>)(c - b, a), 1);
BOOST_CHECK_EQUAL( (std::max<T>)(a, b + c), 11);
BOOST_CHECK_EQUAL( (std::max<T>)(b + c, a), 11);
BOOST_CHECK_EQUAL( (std::max<T>)(a, c - b), a);
BOOST_CHECK_EQUAL( (std::max<T>)(c - b, a), a);
BOOST_CHECK_EQUAL( (std::min<T>)(a + b, b + c), 7);
BOOST_CHECK_EQUAL( (std::min<T>)(b + c, a + b), 7);
BOOST_CHECK_EQUAL( (std::max<T>)(a + b, b + c), 11);
BOOST_CHECK_EQUAL( (std::max<T>)(b + c, a + b), 11);
BOOST_CHECK_EQUAL( (std::min<T>)(a + b, c - a), 4);
BOOST_CHECK_EQUAL( (std::min<T>)(c - a, a + b), 4);
BOOST_CHECK_EQUAL( (std::max<T>)(a + b, c - a), 7);
BOOST_CHECK_EQUAL( (std::max<T>)(c - a, a + b), 7);
long l1(2), l2(3), l3;
l3 = min(l1, l2) + max(l1, l2) + max<long>(l1, l2) + min<long>(l1, l2);
l3 = (std::min)(l1, l2) + (std::max)(l1, l2) + (std::max<long>)(l1, l2) + (std::min<long>)(l1, l2);
BOOST_CHECK_EQUAL(l3, 10);
#endif
@@ -2966,18 +2968,18 @@ void test()
// string and string_view:
//
{
std::string s("2");
Real x(s);
std::string s1("2");
Real x(s1);
BOOST_CHECK_EQUAL(x, 2);
s = "3";
x.assign(s);
s1 = "3";
x.assign(s1);
BOOST_CHECK_EQUAL(x, 3);
#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
s = "20";
std::string_view v(s.c_str(), 1);
s1 = "20";
std::string_view v(s1.c_str(), 1);
Real y(v);
BOOST_CHECK_EQUAL(y, 2);
std::string_view v2(s.c_str(), 2);
std::string_view v2(s1.c_str(), 2);
y.assign(v2);
BOOST_CHECK_EQUAL(y, 20);
#endif

View File

@@ -27,7 +27,7 @@ typedef number<cpp_bin_float<std::numeric_limits<good_type>::digits, digit_base_
int main()
{
float f = std::numeric_limits<float>::max();
float f = (std::numeric_limits<float>::max)();
do
{

View File

@@ -636,7 +636,7 @@ struct tester
BOOST_CHECK_EQUAL(n >> ~boost::uint64_t(0), n);
// Test min value. This actually -(2^256-1), not -(2^255) as in C.
s256 h = std::numeric_limits<s256>::min();
s256 h = (std::numeric_limits<s256>::min)();
BOOST_CHECK_LT(h, 0);
BOOST_CHECK_EQUAL(h >> 0, h);
BOOST_CHECK_EQUAL(h >> 256, -1);

View File

@@ -1,3 +1,6 @@
// Copyright 2012 John Maddock. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
@@ -90,28 +93,28 @@ BOOST_MP_EIGEN_SCALAR_TRAITS_DECL(int)
BOOST_MP_EIGEN_SCALAR_TRAITS_DECL(unsigned int)
BOOST_MP_EIGEN_SCALAR_TRAITS_DECL(long)
BOOST_MP_EIGEN_SCALAR_TRAITS_DECL(unsigned long)
#if 0
#if 0
template<class Backend, boost::multiprecision::expression_template_option ExpressionTemplates, class Backend2, boost::multiprecision::expression_template_option ExpressionTemplates2, typename BinaryOp>
struct ScalarBinaryOpTraits<boost::multiprecision::number<Backend, ExpressionTemplates>, boost::multiprecision::number<Backend2, ExpressionTemplates2>, BinaryOp>
{
static_assert(
boost::multiprecision::is_compatible_arithmetic_type<boost::multiprecision::number<Backend2, ExpressionTemplates2>, boost::multiprecision::number<Backend, ExpressionTemplates> >::value
|| boost::multiprecision::is_compatible_arithmetic_type<boost::multiprecision::number<Backend, ExpressionTemplates>, boost::multiprecision::number<Backend2, ExpressionTemplates2> >::value, "Interoperability with this arithmetic type is not supported.");
typedef typename boost::mpl::if_c<boost::is_convertible<boost::multiprecision::number<Backend2, ExpressionTemplates2>, boost::multiprecision::number<Backend, ExpressionTemplates> >::value,
typedef typename boost::mpl::if_c<boost::is_convertible<boost::multiprecision::number<Backend2, ExpressionTemplates2>, boost::multiprecision::number<Backend, ExpressionTemplates> >::value,
boost::multiprecision::number<Backend, ExpressionTemplates>, boost::multiprecision::number<Backend2, ExpressionTemplates2> >::type ReturnType;
};
};
template<unsigned D, typename BinaryOp>
struct ScalarBinaryOpTraits<boost::multiprecision::number<boost::multiprecision::backends::mpc_complex_backend<D>, boost::multiprecision::et_on>, boost::multiprecision::mpfr_float, BinaryOp>
{
typedef boost::multiprecision::number<boost::multiprecision::backends::mpc_complex_backend<D>, boost::multiprecision::et_on> ReturnType;
};
};
template<typename BinaryOp>
struct ScalarBinaryOpTraits<boost::multiprecision::mpfr_float, boost::multiprecision::mpc_complex, BinaryOp>
{
typedef boost::multiprecision::number<boost::multiprecision::backends::mpc_complex_backend<0>, boost::multiprecision::et_on> ReturnType;
};
};
template<class Backend, boost::multiprecision::expression_template_option ExpressionTemplates, typename BinaryOp>
struct ScalarBinaryOpTraits<boost::multiprecision::number<Backend, ExpressionTemplates>, boost::multiprecision::number<Backend, ExpressionTemplates>, BinaryOp>
@@ -360,7 +363,7 @@ void example10()
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl;
cout << "a.min(a.abs().sqrt()) =" << endl
<< a.min(a.abs().sqrt()) << endl;
<< a.std::min)(a.abs().sqrt()) << endl;
}
template <class Num>

View File

@@ -195,7 +195,7 @@ void test()
}
else
{
BOOST_CHECK_LE(exp(bug_case), std::numeric_limits<T>::min());
BOOST_CHECK_LE(exp(bug_case), (std::numeric_limits<T>::min)());
}
}
bug_case = log((std::numeric_limits<T>::max)()) / -1.0005;

View File

@@ -144,8 +144,8 @@ int main()
//
// Float to rational:
//
static const int max_range = std::numeric_limits<double>::digits >= std::numeric_limits<int>::digits ? std::numeric_limits<int>::max() : (1 << (std::numeric_limits<double>::digits - 1)) - 1;
static const int min_range = std::numeric_limits<double>::digits >= std::numeric_limits<int>::digits ? std::numeric_limits<int>::min() : -(1 << (std::numeric_limits<double>::digits - 1)) + 1;
static const int max_range = std::numeric_limits<double>::digits >= std::numeric_limits<int>::digits ? (std::numeric_limits<int>::max)() : (1 << (std::numeric_limits<double>::digits - 1)) - 1;
static const int min_range = std::numeric_limits<double>::digits >= std::numeric_limits<int>::digits ? (std::numeric_limits<int>::min)() : -(1 << (std::numeric_limits<double>::digits - 1)) + 1;
static const boost::random::uniform_int_distribution<> i_val_dist(min_range, max_range);
static const boost::random::uniform_int_distribution<> i_exp_dist(std::numeric_limits<double>::min_exponent, std::numeric_limits<double>::max_exponent - 2 - std::numeric_limits<int>::digits);
int iv = i_val_dist(small_gen);

View File

@@ -1,3 +1,7 @@
// Copyright 2012 John Maddock. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#include <type_traits>
#include "test.hpp"
#include <boost/multiprecision/mpc.hpp>

View File

@@ -112,13 +112,13 @@ void test_specific(const boost::mpl::int_<boost::multiprecision::number_kind_flo
if (std::numeric_limits<Number>::has_denorm == std::denorm_present)
{
BOOST_TEST(FP_SUBNORMAL == (boost::math::fpclassify)(std::numeric_limits<Number>::denorm_min()));
BOOST_TEST(FP_SUBNORMAL == (boost::math::fpclassify)(std::numeric_limits<Number>::min() / 2));
BOOST_TEST(FP_SUBNORMAL == (boost::math::fpclassify)((std::numeric_limits<Number>::min)() / 2));
BOOST_TEST((boost::math::isfinite)(std::numeric_limits<Number>::denorm_min()));
BOOST_TEST(!(boost::math::isnormal)(std::numeric_limits<Number>::denorm_min()));
BOOST_TEST(!(boost::math::isinf)(std::numeric_limits<Number>::denorm_min()));
BOOST_TEST(!(boost::math::isnan)(std::numeric_limits<Number>::denorm_min()));
BOOST_TEST(0 == std::numeric_limits<Number>::denorm_min() / 2);
BOOST_TEST(0 != std::numeric_limits<Number>::min() / 2);
BOOST_TEST(0 != (std::numeric_limits<Number>::min)() / 2);
BOOST_TEST(0 != std::numeric_limits<Number>::denorm_min());
}
}

View File

@@ -818,7 +818,7 @@ void test()
}
else
{
BOOST_CHECK_LE(pow(T(1.01), bug_case), std::numeric_limits<T>::min());
BOOST_CHECK_LE(pow(T(1.01), bug_case), (std::numeric_limits<T>::min)());
}
}
}

View File

@@ -583,8 +583,8 @@ void test_poison()
result += log2(a);
result += remainder(a, b);
result += trunc(b);
result += min(a, b);
result += max(a, b);
result += (min)(a, b);
result += (max)(a, b);
#if !BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION, < 60000)