mirror of
https://github.com/boostorg/integer.git
synced 2025-07-30 04:37:13 +02:00
Update docs. [CI SKIP]
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
[quickbook 1.6]
|
||||
[compatibility-mode 1.5]
|
||||
[copyright 2001-2009 Beman Dawes, Daryle Walker, Gennaro Prota, John Maddock]
|
||||
[purpose Integer Type Selection]
|
||||
[license
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -65,6 +64,18 @@ compile-time value; and computing min and max of constant expressions.
|
||||
[Templates for finding the extrema of two numbers:
|
||||
Use to find a bound based on a minimum or maximum value. Useful for generic programming. ]
|
||||
]
|
||||
[
|
||||
[[link boost_integer.extended_euclidean Extended Euclidean algorithm].]
|
||||
[[^[@../../../../boost/integer/extended_euclidean.hpp <boost/integer/extended_euclidean.hpp>]]]
|
||||
[Solves /mx + ny = gcd(x,y)/ for /x/ and /y/.]
|
||||
]
|
||||
[
|
||||
[[link boost_integer.mod_inverse Modular multiplicative inverse].]
|
||||
[[^[@../../../../boost/integer/mod_inverse.hpp <boost/integer/mod_inverse.hpp>]]]
|
||||
[Given /a/ and /m/, solves /ax/ = 1 mod /m/ for /x/.]
|
||||
]
|
||||
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
@ -317,10 +328,10 @@ The following table describes each template's criteria.
|
||||
{
|
||||
boost::int_t<24>::least my_var; // my_var has at least 24-bits
|
||||
//...
|
||||
// This one is guarenteed not to be truncated:
|
||||
// This one is guaranteed not to be truncated:
|
||||
boost::int_max_value_t<1000>::least my1000 = 1000;
|
||||
//...
|
||||
// This one is guarenteed not to be truncated, and as fast
|
||||
// This one is guaranteed not to be truncated, and as fast
|
||||
// to manipulate as possible, its size may be greater than
|
||||
// that of my1000:
|
||||
boost::int_max_value_t<1000>::fast my_fast1000 = 1000;
|
||||
@ -364,7 +375,8 @@ for sharing their designs for similar templates.
|
||||
[endsect]
|
||||
|
||||
[include gcd/math-gcd.qbk]
|
||||
|
||||
[include modular_arithmetic/extended_euclidean.qbk]
|
||||
[include modular_arithmetic/mod_inverse.qbk]
|
||||
|
||||
[section:mask Integer Masks]
|
||||
|
||||
|
@ -14,7 +14,7 @@ A fast algorithm for computing modular multiplicative inverses based on the exte
|
||||
namespace boost { namespace integer {
|
||||
|
||||
template<class Z>
|
||||
boost::optional<Z> mod_inverse(Z a, Z p);
|
||||
boost::optional<Z> mod_inverse(Z a, Z m);
|
||||
|
||||
}}
|
||||
|
||||
@ -22,7 +22,7 @@ A fast algorithm for computing modular multiplicative inverses based on the exte
|
||||
|
||||
[section Usage]
|
||||
|
||||
Multiplicative modular inverses exist if and only if /a/ and /p/ are coprime.
|
||||
Multiplicative modular inverses exist if and only if /a/ and /m/ are coprime.
|
||||
So for example
|
||||
|
||||
auto x = mod_inverse(2, 5);
|
||||
|
Reference in New Issue
Block a user