diff --git a/.travis.yml b/.travis.yml index c2ea802c..c8b6a064 100644 --- a/.travis.yml +++ b/.travis.yml @@ -780,3 +780,4 @@ script: notifications: email: on_success: always + diff --git a/doc/html/boost_multiprecision/indexes/s01.html b/doc/html/boost_multiprecision/indexes/s01.html index edc8e022..d247bd13 100644 --- a/doc/html/boost_multiprecision/indexes/s01.html +++ b/doc/html/boost_multiprecision/indexes/s01.html @@ -24,7 +24,7 @@
A B C D E F H I L M N O P R S T V X Z
constexpr
+ +convert_to
e
+ +empty
infinity
- +integer_modulus
@@ -909,7 +918,7 @@cpp_dec_float_50
A B C D E F G H I L M N O P R S T U V X Z
constexpr
+ +Constructing and Interconverting Between Number Types
cpp_dec_float_50
e
+ +empty
infinity
- +Input Output
@@ -1162,7 +1171,10 @@Literal Types and constexpr Support
- +llrint
@@ -1243,6 +1255,7 @@std::numeric_limits<> constants
- -std::numeric_limits<> functions
+std :: numeric_limits <> functions
std::numeric_limits<> constants
+ +str
Multiprecision consists of a generic interface to the mathematics of large - numbers as well as a selection of big number back ends, with support for integer, + numbers as well as a selection of big number back-ends, with support for integer, rational, floating-point, and complex types. Boost.Multiprecision provides - a selection of back ends provided off-the-rack in including interfaces to GMP, + a selection of back-ends provided off-the-rack in including interfaces to GMP, MPFR, MPIR, MPC, TomMath as well as its own collection of Boost-licensed, header-only - back ends for integers, rationals and floats. In addition, user-defined back - ends can be created and used with the interface of Multiprecision, provided - the class implementation adheres to the necessary concepts. + back-ends for integers, rationals and floats. In addition, user-defined back-ends + can be created and used with the interface of Multiprecision, provided the + class implementation adheres to the necessary concepts.
Depending upon the number type, precision may be arbitrarily large (limited - only by available memory), fixed at compile time (for example 50 or 100 decimal + only by available memory), fixed at compile time (for example, 50 or 100 decimal digits), or a variable controlled at run-time by member functions. The types are expression - template -enabled for better performance than naive user-defined types. + templates - enabled for better performance than naive user-defined + types.
The Multiprecision library comes in two distinct parts: @@ -77,17 +79,50 @@ back-ends rely on 3rd party libraries, but a header-only Boost license version is always available (if somewhat slower).
+- Should you just wish to cut to the chase and use a fully Boost-licensed number - type, then skip to cpp_int - for multiprecision integers, cpp_rational - for rational types, cpp_dec_float - for multiprecision floating-point types and cpp_complex - for complex types. + Should you just wish to 'cut to the chase' just to get bigger integers or bigger + and more precise reals as simply and portably as possible, close to 'drop-in' + replacements for the fundamental + (built-in) type anlogs, then use a fully Boost-licensed number type, + and skip to: +
+
+ The library is very often used via one of the predefined convenience typedefs like boost::multiprecision::int128_t
+ or boost::multiprecision::cpp_bin_float_quad.
- The library is often used via one of the predefined typedefs: for example if - you wanted an arbitrary + For example, if you want a signed, 128-bit fixed size integer: +
+#include <boost/multiprecision/cpp_int.hpp> // Integer types. + +boost::multiprecision::int128_t my_128_bit_int; ++
+ Alternatively, and more adventurously, if you wanted an arbitrary precision integer type using GMP as the underlying implementation then you could use:
@@ -96,27 +131,37 @@ boost::multiprecision::mpz_int myint; // Arbitrary precision integer type.
- Alternatively, you can compose your own multiprecision type, by combining
+ Or for a simple, portable 128-bit floating-point close to a drop-in for a
+ fundamental (built-in)
+ type like double, usually
+ 64-bit
+
#include <boost/multiprecision/cpp_bin_float.hpp> + +boost::multiprecision::cpp_bin_float_quad my_quad_real; ++
+ Alternatively, you can compose your own 'custom' multiprecision type, by combining
number with one of the predefined
back-end types. For example, suppose you wanted a 300 decimal digit floating-point
type based on the MPFR library. In
- this case, there's no predefined typedef with that level of precision, so instead
- we compose our own:
+ this case, there's no predefined typedef
+ with that level of precision, so instead we compose our own:
#include <boost/multiprecision/mpfr.hpp> // Defines the Backend type that wraps MPFR +#include <boost/multiprecision/mpfr.hpp> // Defines the Backend type that wraps MPFR. namespace mp = boost::multiprecision; // Reduce the typing a bit later... typedef mp::number<mp::mpfr_float_backend<300> > my_float; -my_float a, b, c; // These variables have 300 decimal digits precision +my_float a, b, c; // These variables have 300 decimal digits precision.We can repeat the above example, but with the expression templates disabled (for faster compile times, but slower runtimes) by passing a second template argument to
-number:#include <boost/multiprecision/mpfr.hpp> // Defines the Backend type that wraps MPFR +#include <boost/multiprecision/mpfr.hpp> // Defines the Backend type that wraps MPFR. namespace mp = boost::multiprecision; // Reduce the typing a bit later... @@ -160,7 +205,7 @@ b = a * 3.14; // Error, no operator overload if the conversion would be explicit.- + Move Semantics
@@ -200,7 +245,7 @@ library containers.- + Expression Templates
@@ -224,15 +269,15 @@ unmentionable-type operator * (const number<Backend>& a, const number<Backend>& b);- Where the "unmentionable" return type is an implementation detail - that, rather than containing the result of the multiplication, contains instructions - on how to compute the result. In effect it's just a pair of references to the - arguments of the function, plus some compile-time information that stores what - the operation is. + Where the 'unmentionable' return type is an implementation + detail that, rather than containing the result of the multiplication, contains + instructions on how to compute the result. In effect it's just a pair of references + to the arguments of the function, plus some compile-time information that stores + what the operation is.
The great advantage of this method is the elimination of temporaries: - for example the "naive" implementation of
operator*above, requires one temporary for computing + for example, the "naive" implementation ofoperator*above, requires one temporary for computing the result, and at least another one to return it. It's true that sometimes this overhead can be reduced by using move-semantics, but it can't be eliminated completely. For example, lets suppose we're evaluating a polynomial via Horner's @@ -374,28 +419,29 @@In fact it is particularly easy to create dangling references by mixing expression - templates with the auto keyword, for example: + templates with the
autokeyword, + for example:
auto val = cpp_dec_float_50("23.1") * 100;- In this situation the integer literal is stored directly in the expression - template - so its use is OK here - but the cpp_dec_float_50 temporary is - stored by reference and then destructed when the statement completes leaving - a dangling reference. + In this situation, the integer literal is stored directly in the expression + template - so its use is OK here - but the
cpp_dec_float_50+ temporary is stored by reference and then destructed when the statement completes, + leaving a dangling reference.If in doubt, do not ever mix expression templates - with the auto keyword. + with the
autokeyword.
And finally... the performance improvements from an expression template library like this are often not as dramatic as the reduction in number of temporaries - would suggest. For example if we compare this library with mpfr_class + would suggest. For example, if we compare this library with mpfr_class and mpreal, with all three using the underlying MPFR library at 50 decimal digits precision then we see the following typical results @@ -720,7 +766,7 @@
[1] The actual number generated will depend on the compiler, how well it optimizes the code, and whether it supports rvalue references. The number of 11 temporaries - was generated with Visual C++ 10 + was generated with Visual C++ 2010.
cpp_bin_50
+ and cpp_dec_50?
Unless you have a specific reason to choose cpp_dec_,
diff --git a/doc/html/boost_multiprecision/tut.html b/doc/html/boost_multiprecision/tut.html
index f92dc00a..34fcb293 100644
--- a/doc/html/boost_multiprecision/tut.html
+++ b/doc/html/boost_multiprecision/tut.html
@@ -91,7 +91,8 @@
constexpr Supportcpp_int
+ and cpp_bin_float
std::numeric_limits<> functionsnumber on this backend
move aware.
+constexpr
+ aware - basic constexpr arithmetic is supported from C++14 and onwards,
+ comparisons, plus the functions fabs,
+ abs, fpclassify, isnormal,
+ isfinite, isinf and isnan
+ are also supported if either the compiler implements C++20's std::is_constant_evaluated(),
+ or if the compiler is GCC.
+ float128 can be
used as a literal type (constexpr support).
float128 can be
+ used for full constexpr
+ arithmetic from C++14 and later with GCC. The functions abs, fabs,
+ fpclassify, isnan, isinf,
+ isfinite and isnormal are also constexpr,
+ but the transcendental functions are not.
+ float128
if it's available and _Quad
diff --git a/doc/html/boost_multiprecision/tut/floats/fp_eg/variable_precision.html b/doc/html/boost_multiprecision/tut/floats/fp_eg/variable_precision.html
index fc8dba89..946d625c 100644
--- a/doc/html/boost_multiprecision/tut/floats/fp_eg/variable_precision.html
+++ b/doc/html/boost_multiprecision/tut/floats/fp_eg/variable_precision.html
@@ -191,7 +191,7 @@ Relative error: 7.55843e-1501
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;
diff --git a/doc/html/boost_multiprecision/tut/gen_int.html b/doc/html/boost_multiprecision/tut/gen_int.html
index a272d08c..b4bb1179 100644
--- a/doc/html/boost_multiprecision/tut/gen_int.html
+++ b/doc/html/boost_multiprecision/tut/gen_int.html
@@ -31,7 +31,8 @@
integer operations<boost/multiprecision/integer.hpp>.
Where these operations require a temporary increase in precision (such as
- for powm), then if no built in type is available, a cpp_int
+ for powm), then if no built
+ in type is available, a cpp_int
of appropriate precision will be used.
@@ -161,7 +162,7 @@
The regular Miller-Rabin functions in <boost/multiprecision/miller_rabin.hpp>
are defined in terms of the above generic operations, and so function equally
- well for built in and multiprecision types.
+ well for built-in or __fundamental_types and multiprecision types.
Note that this function is optimized for the case where the data can be
- memcpy'ed from the source to the integer - in this case both iterators
- much be pointers, and everything must be little-endian.
+ |
@@ -199,7 +201,7 @@
import_bits(i, v.begin(), v.end());
cpp_bin_float_100 g(i);
g.backend().exponent() = e;
- assert(f == g);
+ BOOST_ASSERT(f == g);
}
diff --git a/doc/html/boost_multiprecision/tut/interval/mpfi.html b/doc/html/boost_multiprecision/tut/interval/mpfi.html
index 13c791fa..b4b9d7b1 100644
--- a/doc/html/boost_multiprecision/tut/interval/mpfi.html
+++ b/doc/html/boost_multiprecision/tut/interval/mpfi.html
@@ -54,11 +54,11 @@
Type mpfi_float_backend
can be used at fixed precision by specifying a non-zero Digits10
template parameter, or at variable precision by setting the template argument
- to zero. The typedefs mpfi_float_50, mpfi_float_100, mpfi_float_500, mpfi_float_1000
- provide arithmetic types at 50, 100, 500 and 1000 decimal digits precision
- respectively. The typedef mpfi_float provides a variable precision type
- whose precision can be controlled via the numbers
- member functions.
+ to zero. The typedefs mpfi_float_50, mpfi_float_100,
+ mpfi_float_500, mpfi_float_1000 provide arithmetic types
+ at 50, 100, 500 and 1000 decimal digits precision respectively. The typedef mpfi_float
+ provides a variable precision type whose precision can be controlled via
+ the numbers member functions.