More docs improvements

This commit is contained in:
ckormanyos
2025-07-12 21:07:16 +02:00
parent 2b1c173e2e
commit a7731263bc
6 changed files with 8 additions and 60 deletions

View File

@@ -26,7 +26,7 @@ requiring extended range and precision.
Multiprecision consists of a generic interface to the mathematics
of large numbers as well as a selection of big number backends.
This includes interfaces to GMP, MPFR, MPIR and TomMath
These include interfaces to GMP, MPFR, MPIR and TomMath
and also Multiprecision's own collection of Boost-licensed,
header-only backends for integers, rationals, floats and complex-floats.
@@ -42,6 +42,9 @@ This usually provides better performance than using types configured without exp
The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/multiprecision/index.html).
A practical, comprehensive, instructive, clear and very helpful video regarding the use of Multiprecision
can be found [here](https://www.youtube.com/watch?v=mK4WjpvLj4c).
## Using Multiprecision
<p align="center">

View File

@@ -16,6 +16,9 @@ In order to use this library you need to make two choices:
[link boost_multiprecision.tut.floats floating-point], [link boost_multiprecision.tut.rational rational], or [link boost_multiprecision.tut.complex complex]).
* Which back-end do I want to perform the actual arithmetic (Boost-supplied, GMP, MPFR, MPC, Tommath etc)?
A practical, comprehensive, instructive, clear and very helpful video regarding the use of Multiprecision
can be found [@https://www.youtube.com/watch?v=mK4WjpvLj4c here].
[include tutorial_integer.qbk]
[include tutorial_floats.qbk]
[include tutorial_interval_mpfi.qbk]

View File

@@ -1,50 +0,0 @@
[/
Copyright 2011 - 2020 John Maddock.
Copyright 2013 - 2019 Paul A. Bristow.
Copyright 2013 Christopher Kormanyos.
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).
]
[section:tommath_rational tommath_rational]
`#include <boost/multiprecision/tommath.hpp>`
namespace boost{ namespace multiprecision{
typedef rational_adpater<tommath_int> tommath_rational;
typedef number<tommath_rational > tom_rational;
}} // namespaces
The `tommath_rational` back-end is used via the typedef `boost::multiprecision::tom_rational`. It acts as a thin wrapper around
`boost::rational<tom_int>`
to provide a rational number type that is a drop-in replacement for the native C++ number types, but with unlimited precision.
The advantage of using this type rather than `boost::rational<tom_int>` directly, is that it is expression-template enabled,
greatly reducing the number of temporaries created in complex expressions.
There are also non-member functions:
tom_int numerator(const tom_rational&);
tom_int denominator(const tom_rational&);
which return the numerator and denominator of the number.
Things you should know when using this type:
* Default constructed `tom_rational`s have the value zero (this the inherited Boost.Rational behavior).
* Division by zero results in a `std::overflow_error` being thrown.
* Conversion from a string results in a `std::runtime_error` being thrown if the string can not be
interpreted as a valid rational number.
* No changes are made to [tommath]'s global state, so this type can safely coexist with other [tommath] code.
* Performance of this type has been found to be pretty poor - this need further investigation - but it appears that Boost.Rational
needs some improvement in this area.
[h5 Example:]
[mp_rat_eg]
[endsect] [/section:tommath_rational tommath_rational]

View File

@@ -32,13 +32,7 @@ multiprecision values can easily be inspected in the debugger by looking at the
The down side of this approach is that runtimes are much slower when using this type. Set against that it can make
debugging very much easier, certainly much easier than sprinkling code with `printf` statements.
When used in conjunction with the Visual C++ debugger visualisers, the value of a multiprecision type that uses this
backend is displayed in the debugger just a __fundamental value would be, here we're inspecting a value of type
`number<debug_adaptor<cpp_dec_float<50> > >`:
[$../debugger1.png]
Otherwise you will need to expand out the view and look at the "debug_value" member:
You will need to expand out the view and look at the "debug_value" member:
[$../debugger2.png]

View File

@@ -14,6 +14,5 @@ Backend types listed in this section are predominantly designed to aid debugging
[include tutorial_logged_adaptor.qbk]
[include tutorial_debug_adaptor.qbk]
[include tutorial_visualizers.qbk]
[endsect] [/section:misc Miscellaneous Number Types.]

View File

@@ -24,7 +24,6 @@ The following back-ends provide rational number arithmetic:
[include tutorial_cpp_rational.qbk]
[include tutorial_gmp_rational.qbk]
[include tutorial_tommath_rational.qbk]
[include tutorial_boost_rational.qbk]
[include tutorial_rational_adaptor.qbk]
[endsect] [/section:rational Rational Number Types]