add line with math exprs to docs for DELTA, MIN and MAX
This commit is contained in:
parent
57ec630b67
commit
efbaac69de
|
@ -502,7 +502,7 @@ assert_eq!(two_point_75.to_string(), \"2.8\");
|
||||||
|
|
||||||
// inherent methods that do not require Frac bounds, some of which can thus be const
|
// inherent methods that do not require Frac bounds, some of which can thus be const
|
||||||
fixed_no_frac! {
|
fixed_no_frac! {
|
||||||
$Fixed[$s_fixed]($Inner[$s_inner], $LeEqU, $s_nbits),
|
$Fixed[$s_fixed]($Inner[$s_inner], $LeEqU, $s_nbits, $s_nbits_m1),
|
||||||
$nbytes, $bytes_val, $rev_bytes_val, $be_bytes, $le_bytes,
|
$nbytes, $bytes_val, $rev_bytes_val, $be_bytes, $le_bytes,
|
||||||
$UFixed[$s_ufixed], $UInner, $Signedness,
|
$UFixed[$s_ufixed], $UInner, $Signedness,
|
||||||
$Double, $DoubleInner, $s_nbits_2, $HasDouble
|
$Double, $DoubleInner, $s_nbits_2, $HasDouble
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
|
|
||||||
macro_rules! fixed_no_frac {
|
macro_rules! fixed_no_frac {
|
||||||
(
|
(
|
||||||
$Fixed:ident[$s_fixed:expr]($Inner:ty[$s_inner:expr], $LeEqU:tt, $s_nbits:expr),
|
$Fixed:ident[$s_fixed:expr](
|
||||||
|
$Inner:ty[$s_inner:expr], $LeEqU:tt, $s_nbits:expr, $s_nbits_m1:expr
|
||||||
|
),
|
||||||
$nbytes:expr, $bytes_val:expr, $rev_bytes_val:expr, $be_bytes:expr, $le_bytes:expr,
|
$nbytes:expr, $bytes_val:expr, $rev_bytes_val:expr, $be_bytes:expr, $le_bytes:expr,
|
||||||
$UFixed:ident[$s_ufixed:expr], $UInner:ty, $Signedness:tt,
|
$UFixed:ident[$s_ufixed:expr], $UInner:ty, $Signedness:tt,
|
||||||
$Double:ident, $DoubleInner:ty, $s_nbits_2:expr, $HasDouble:tt
|
$Double:ident, $DoubleInner:ty, $s_nbits_2:expr, $HasDouble:tt
|
||||||
|
@ -40,6 +42,9 @@ assert_eq!(Fix::ZERO, Fix::from_bits(0));
|
||||||
comment! {
|
comment! {
|
||||||
"The difference between any two successive representable numbers, <i>Δ</i>.
|
"The difference between any two successive representable numbers, <i>Δ</i>.
|
||||||
|
|
||||||
|
If the number has <i>f</i> = `Frac` fractional bits, then
|
||||||
|
<i>Δ</i> = 1/2<sup><i>f</i></sup>.
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
@ -56,6 +61,17 @@ assert_eq!(Fix::DELTA, 0.0625);
|
||||||
comment! {
|
comment! {
|
||||||
"The smallest value that can be represented.
|
"The smallest value that can be represented.
|
||||||
|
|
||||||
|
",
|
||||||
|
if_signed_unsigned! {
|
||||||
|
$Signedness,
|
||||||
|
concat!(
|
||||||
|
"If the number has <i>f</i> = `Frac` fractional bits,
|
||||||
|
then the minimum is −2<sup>", $s_nbits_m1, "</sup>/2<sup><i>f</i></sup>."
|
||||||
|
),
|
||||||
|
"The minimum of unsigned numbers is 0."
|
||||||
|
},
|
||||||
|
"
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
@ -70,6 +86,11 @@ assert_eq!(Fix::MIN, Fix::from_bits(", $s_inner, "::MIN));
|
||||||
comment! {
|
comment! {
|
||||||
"The largest value that can be represented.
|
"The largest value that can be represented.
|
||||||
|
|
||||||
|
If the number has <i>f</i> = `Frac` fractional bits, then the maximum is
|
||||||
|
(2<sup>",
|
||||||
|
if_signed_unsigned!($Signedness, $s_nbits_m1, $s_nbits),
|
||||||
|
"</sup> − 1)/2<sup><i>f</i></sup>.
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|
Loading…
Reference in New Issue