Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
joseluis committed Jan 6, 2024
1 parent 61735e1 commit a96c827
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions src/num/int/wrapper/impl_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ macro_rules! impl_base {
(@signed $t:ty : $dl:literal) => { paste! {
/* signed digits */

#[doc = "# Numeric base related methods for `" $t "`\n\n"]
#[doc = "# Integer base related methods for `" $t "`\n\n"]
#[doc = "- [digits](#method.digits" $dl ")"]
#[doc = "- [digits_sign](#method.digits_sign" $dl ")"]
#[doc = "- [digits_base](#method.digits_base" $dl ")"]
Expand Down Expand Up @@ -161,7 +161,7 @@ macro_rules! impl_base {

// implements unsigned ops
(@unsigned $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric base related methods for `" $t "`\n\n"]
#[doc = "# Integer base related methods for `" $t "`\n\n"]
#[doc = "- [digits](#method.digits" $dl ")"]
#[doc = "- [digits_sign](#method.digits_sign" $dl ")"]
#[doc = "- [digits_base](#method.digits_base" $dl ")"]
Expand Down
4 changes: 2 additions & 2 deletions src/num/int/wrapper/impl_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro_rules! impl_count {

// implements signed ops
(@signed $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric counting related methods for `" $t "`\n\n"]
#[doc = "# Integer counting related methods for `" $t "`\n\n"]
#[doc = "- [factorial](#method.factorial" $dl ")"]
#[doc = "- [combine](#method.combine" $dl ")"]
#[doc = "- [combine_rep](#method.combine_rep" $dl ")"]
Expand Down Expand Up @@ -231,7 +231,7 @@ macro_rules! impl_count {

// implements unsigned ops
(@unsigned $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric counting related methods for `" $t "`\n\n"]
#[doc = "# Integer counting related methods for `" $t "`\n\n"]
#[doc = "- [factorial](#method.factorial" $dl ")"]
#[doc = "- [combine](#method.combine" $dl ")"]
#[doc = "- [combine_rep](#method.combine_rep" $dl ")"]
Expand Down
4 changes: 2 additions & 2 deletions src/num/int/wrapper/impl_div.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ macro_rules! impl_div {
(@signed $t:ty : $dl:literal) => { paste! {
/* signed division */

#[doc = "# Numeric division related methods for `" $t "`\n\n"]
#[doc = "# Integer division related methods for `" $t "`\n\n"]
#[doc = "- [div_rem](#method.div_rem" $dl ")"]
#[doc = "- [div_ceil](#method.div_ceil" $dl ")"]
#[doc = "- [div_floor](#method.div_floor" $dl ")"]
Expand Down Expand Up @@ -220,7 +220,7 @@ macro_rules! impl_div {

// implements unsigned ops
(@unsigned $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric division related methods for `" $t "`\n\n"]
#[doc = "# Integer division related methods for `" $t "`\n\n"]
#[doc = "- [div_rem](#method.div_rem" $dl ")"]
#[doc = "- [div_ceil](#method.div_ceil" $dl ")"]
#[doc = "- [div_floor](#method.div_floor" $dl ")"]
Expand Down
4 changes: 2 additions & 2 deletions src/num/int/wrapper/impl_factors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ macro_rules! impl_factors {

// implements signed ops
(@signed $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric factors-related methods for `" $t "`\n\n"]
#[doc = "# Integer factors related methods for `" $t "`\n\n"]
/// - Allocating:
#[doc = " - [factors](#method.factors" $dl ")"]
#[doc = " - [factors_proper](#method.factors_proper" $dl ")"]
Expand Down Expand Up @@ -356,7 +356,7 @@ macro_rules! impl_factors {

// implements unsigned ops
(@unsigned $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric factors-related methods for `" $t "`\n\n"]
#[doc = "# Integer factors related methods for `" $t "`\n\n"]
/// - Allocating:
#[doc = " - [factors](#method.factors" $dl ")"]
#[doc = " - [factors_proper](#method.factors_proper" $dl ")"]
Expand Down
4 changes: 2 additions & 2 deletions src/num/int/wrapper/impl_gcd_lcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ macro_rules! impl_gcd_lcm {
(@signed $t:ty : $up:ty : $dl:literal) => { paste! {
/* signed count_digits */

#[doc = "# Numeric <abbr title='Greatest Common Divisor'>GCD</abbr> and "
#[doc = "# Integer <abbr title='Greatest Common Divisor'>GCD</abbr> and "
"<abbr title='Least Common Multiple'>LCM</abbr> related methods for `" $t "`\n\n"]
#[doc = "- [gcd](#method.gcd" $dl ")"]
#[doc = "- [gcd_ext](#method.gcd_ext" $dl ")"]
Expand Down Expand Up @@ -198,7 +198,7 @@ macro_rules! impl_gcd_lcm {

// implements unsigned ops
(@unsigned $t:ty : $up:ty : $dl:literal) => { paste! {
#[doc = "# Numeric <abbr title='Greatest Common Divisor'>GCD</abbr> and "
#[doc = "# Integer <abbr title='Greatest Common Divisor'>GCD</abbr> and "
"<abbr title='Least Common Multiple'>LCM</abbr> related methods for `" $t "`\n\n"]
#[doc = "- [gcd](#method.gcd" $dl ")"]
#[doc = "- [lcm](#method.lcm" $dl ")"]
Expand Down
68 changes: 34 additions & 34 deletions src/num/int/wrapper/impl_sqrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ macro_rules! impl_sqrt {
(@signed $t:ty : $dl:literal) => { paste! {
/* signed sqrt */

#[doc = "# Numeric square root related methods for `" $t "`\n\n"]
#[doc = "# Integer square root related methods for `" $t "`\n\n"]
#[doc = "- [is_square](#method.is_square" $dl ")"]
#[doc = "- [sqrt_floor](#method.sqrt_floor" $dl ")"]
#[doc = "- [sqrt_ceil](#method.sqrt_ceil" $dl ")"]
Expand All @@ -31,9 +31,9 @@ macro_rules! impl_sqrt {
/// Returns `false` otherwise, which includes all negative values.
/// # Algorithm
/// $$ \large
/// \text{is\textunderscore square}(n) = \begin{cases}
/// \text{true} & \text{if } \left(\lfloor \sqrt{n} \rfloor\right)^2 = n \cr
/// \text{false} & \text{if } \left(\lfloor \sqrt{n} \rfloor\right)^2 \neq n
/// \text{is\textunderscore square}(a) = \begin{cases}
/// \text{true} & \text{if } \left(\lfloor \sqrt{a} \rfloor\right)^2 = a \cr
/// \text{false} & \text{if } \left(\lfloor \sqrt{a} \rfloor\right)^2 \neq a
/// \end{cases}
/// $$
/// # Examples
Expand All @@ -56,27 +56,27 @@ macro_rules! impl_sqrt {
///
/// Returns `None` if `a` is negative.
/// # Algorithm
/// $$ \large \left\lfloor \sqrt{x} \right\rfloor = n_{k} $$
/// $$ \large \left\lfloor \sqrt{a} \right\rfloor = n_{k} $$
///
/// Where $n_{k}$ is the result of a sequence of estimates that
/// starts with an initial $n_{0} = x/2$ which is updated using
/// starts with an initial $n_{0} = a/2$ which is updated using
/// [*Heron's method*](
/// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Heron's_method):
///
/// $$ \large
/// n_{i+1} = n_{i} - ( n_{i}^{2} - x) / 2n_{i},
/// n_{i+1} = n_{i} - ( n_{i}^{2} - a) / 2n_{i},
/// \quad \small\text{for} \quad i = 0, 1, \ldots, k,
/// $$
///
/// Where $n_{i}$ is the current estimate, $n_{i+1}$ is the next
/// estimate, $x$ is self, and $k$ is the number of iterations
/// estimate, $a$ is self, and $k$ is the number of iterations
/// needed to converge to a solution, on the order of the number of
/// bits of self, about $O(\log_2 b)$, which for e.g. 128 bits would
/// be $ ±7 $ iterations.
///
/// Hence, the function continues updating the estimate until
/// reaching $n_{k}$, which provides the largest integer less than
/// or equal to the square root of `x`.
/// or equal to the square root of `a`.
/// # Examples
/// ```
/// # use devela::num::Int;
Expand Down Expand Up @@ -110,10 +110,10 @@ macro_rules! impl_sqrt {
/// # Algorithm
/// $$ \large
/// \begin{align}
/// \notag \left\lceil \sqrt{x} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } n^2 = x \cr
/// n+1 & \text{if } n^2 < x \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{x} \rfloor &
/// \notag \left\lceil \sqrt{a} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } n^2 = a \cr
/// n+1 & \text{if } n^2 < a \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{a} \rfloor &
/// \end{align}
/// $$
/// # Examples
Expand Down Expand Up @@ -142,10 +142,10 @@ macro_rules! impl_sqrt {
/// # Algorithm
/// $$ \large
/// \begin{align}
/// \notag \left\lfloor\sqrt{x} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } x - n^2 < (n+1)^2 - x \cr
/// n+1 & \text{if } x - n^2 \geq (n+1)^2 - x \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{x} \rfloor &
/// \notag \left\lfloor\sqrt{a} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } a - n^2 < (n+1)^2 - a \cr
/// n+1 & \text{if } a - n^2 \geq (n+1)^2 - a \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{a} \rfloor &
/// \end{align}
/// $$
/// # Examples
Expand Down Expand Up @@ -181,7 +181,7 @@ macro_rules! impl_sqrt {

// implements unsigned ops
(@unsigned $t:ty : $dl:literal) => { paste! {
#[doc = "# Numeric square root related methods for `" $t "`\n\n"]
#[doc = "# Integer square root related methods for `" $t "`\n\n"]
#[doc = "- [is_square](#method.is_square" $dl ")"]
#[doc = "- [sqrt_floor](#method.sqrt_floor" $dl ")"]
#[doc = "- [sqrt_ceil](#method.sqrt_ceil" $dl ")"]
Expand All @@ -195,9 +195,9 @@ macro_rules! impl_sqrt {
///
/// # Algorithm
/// $$ \large
/// \text{is\textunderscore square}(n) = \begin{cases}
/// \text{true} & \text{if } \left(\lfloor \sqrt{n} \rfloor\right)^2 = n \cr
/// \text{false} & \text{if } \left(\lfloor \sqrt{n} \rfloor\right)^2 \neq n
/// \text{is\textunderscore square}(a) = \begin{cases}
/// \text{true} & \text{if } \left(\lfloor \sqrt{a} \rfloor\right)^2 = a \cr
/// \text{false} & \text{if } \left(\lfloor \sqrt{a} \rfloor\right)^2 \neq a
/// \end{cases}
/// $$
///
Expand All @@ -219,27 +219,27 @@ macro_rules! impl_sqrt {

/// Returns the floored integer square root.
/// # Algorithm
/// $$ \large \left\lfloor \sqrt{x} \right\rfloor = n_{k} $$
/// $$ \large \left\lfloor \sqrt{a} \right\rfloor = n_{k} $$
///
/// Where $n_{k}$ is the result of a sequence of estimates that
/// starts with an initial $n_{0} = x/2$ which is updated using
/// starts with an initial $n_{0} = a/2$ which is updated using
/// [*Heron's method*](
/// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Heron's_method):
///
/// $$ \large
/// n_{i+1} = n_{i} - ( n_{i}^{2} - x) / 2n_{i},
/// n_{i+1} = n_{i} - ( n_{i}^{2} - a) / 2n_{i},
/// \quad \small\text{for} \quad i = 0, 1, \ldots, k,
/// $$
///
/// Where $n_{i}$ is the current estimate, $n_{i+1}$ is the next
/// estimate, $x$ is `a`, and $k$ is the number of iterations
/// estimate, $a$ is `a`, and $k$ is the number of iterations
/// needed to converge to a solution, on the order of the number of
/// bits of `a`, about $O(\log_2 b)$, which for e.g. 128 bits would
/// be $ ±7 $ iterations.
///
/// Hence, the function continues updating the estimate until
/// reaching $n_{k}$, which provides the largest integer less than
/// or equal to the square root of `x`.
/// or equal to the square root of `a`.
///
/// # Examples
/// ```
Expand Down Expand Up @@ -269,10 +269,10 @@ macro_rules! impl_sqrt {
/// # Algorithm
/// $$ \large
/// \begin{align}
/// \notag \left\lceil \sqrt{x} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } n^2 = x \cr
/// n+1 & \text{if } n^2 < x \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{x} \rfloor &
/// \notag \left\lceil \sqrt{a} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } n^2 = a \cr
/// n+1 & \text{if } n^2 < a \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{a} \rfloor &
/// \end{align}
/// $$
/// # Examples
Expand All @@ -294,10 +294,10 @@ macro_rules! impl_sqrt {
/// # Algorithm
/// $$ \large
/// \begin{align}
/// \notag \left\lfloor\sqrt{x} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } x - n^2 < (n+1)^2 - x \cr
/// n+1 & \text{if } x - n^2 \geq (n+1)^2 - x \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{x} \rfloor &
/// \notag \left\lfloor\sqrt{a} \thinspace\right\rceil = \begin{cases}
/// n & \text{if } a - n^2 < (n+1)^2 - a \cr
/// n+1 & \text{if } a - n^2 \geq (n+1)^2 - a \end{cases} \cr
/// \notag \normalsize\text{where } n = \lfloor \sqrt{a} \rfloor &
/// \end{align}
/// $$
/// # Examples
Expand Down
28 changes: 14 additions & 14 deletions src/num/int/wrapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ mod impl_sqrt;
///
/// The documentation is the same for all bit sizes. For example, for 32 bits:
/// - Methods for `i32` related to:
/// [base][Self#numeric-base-related-methods-for-i32],
/// [counting][Self#numeric-counting-related-methods-for-i32],
/// [division][Self#numeric-division-related-methods-for-i32],
/// [factors][Self#numeric-factors-related-methods-for-i32],
/// [gcd and lcm][Self#numeric-gcd-and-lcm-related-methods-for-i32].
/// [base][Self#integer-base-related-methods-for-i32],
/// [counting][Self#integer-counting-related-methods-for-i32],
/// [division][Self#integer-division-related-methods-for-i32],
/// [factors][Self#integer-factors-related-methods-for-i32],
/// [gcd and lcm][Self#integer-gcd-and-lcm-related-methods-for-i32],
/// [square root][Self#integer-square-root-related-methods-for-i32].
/// - Methods for `u32` related to:
/// [base][Self#numeric-base-related-methods-for-u32],
/// [counting][Self#numeric-counting-related-methods-for-u32],
/// [division][Self#numeric-division-related-methods-for-u32],
/// [factors][Self#numeric-factors-related-methods-for-u32],
/// [gcd and lcm][Self#numeric-gcd-and-lcm-related-methods-for-u32].
/// [base][Self#integer-base-related-methods-for-u32],
/// [counting][Self#integer-counting-related-methods-for-u32],
/// [division][Self#integer-division-related-methods-for-u32],
/// [factors][Self#integer-factors-related-methods-for-u32],
/// [gcd and lcm][Self#integer-gcd-and-lcm-related-methods-for-u32],
/// [square root][Self#integer-square-root-related-methods-for-u32].
///
/// See also the related traits:
/// [`NumOpsBase`][crate::num::NumOpsBase],
/// [`NumOpsCounting`][crate::num::NumOpsCounting],
/// [`NumOpsFactors`][crate::num::NumOpsFactors],
/// [`NumInt`][super::NumInt].
/// [`NumInt`][super::NumInt],
/// [`NumOpsFactors`][crate::num::NumOpsFactors].
#[repr(transparent)]
pub struct Int<T>(pub T);

Expand Down

0 comments on commit a96c827

Please sign in to comment.