pub enum Q {
Number(Rat),
PosSat,
NegSat,
PosInf,
NegInf,
Nan,
}Expand description
A bounded rational, or an explicit statement that the value is not one.
| variant | denotes |
|---|---|
Number(x) | {x} |
PosSat / NegSat | (MAX_MAG, +∞) / (-∞, -MAX_MAG), reals only |
PosInf / NegInf | {+∞} / {-∞} |
Nan | no information |
Saturation denotes reals, so Number(0) · PosSat == Number(0). PartialEq
is derived and Nan == Nan, which keeps Eq, Hash and the total Ord
lawful. Ord is hand-written: variant order is not value order.
Variants§
Number(Rat)
A representable rational.
PosSat
The true magnitude exceeds MAX_MAG and the value is positive.
NegSat
The true magnitude exceeds MAX_MAG and the value is negative.
PosInf
Exactly +∞.
NegInf
Exactly -∞.
Nan
No information about the value.
Implementations§
Source§impl Q
impl Q
Sourcepub fn is_number(self) -> bool
pub fn is_number(self) -> bool
Whether this is a representable rational.
The four classification predicates are mutually exclusive and jointly
exhaustive. See theorem_classification_partitions.
use the_q::{Q, Rat};
assert!(Q::number(Rat::one()).is_number());
assert!(!Q::PosSat.is_number());
assert!(!Q::Nan.is_number());Sourcepub fn is_saturated(self) -> bool
pub fn is_saturated(self) -> bool
Whether the true magnitude is known to exceed MAX_MAG.
This predicate is not the negation of is_number. It separates an
overflow from a division by zero. That distinction is the purpose of the
saturation states.
use the_q::Q;
assert!(Q::PosSat.is_saturated());
assert!(Q::NegSat.is_saturated());
assert!(!Q::PosInf.is_saturated());Sourcepub fn is_infinite(self) -> bool
pub fn is_infinite(self) -> bool
Whether this is exactly ±∞.
use the_q::Q;
assert!(Q::PosInf.is_infinite());
assert!(Q::NegInf.is_infinite());
assert!(!Q::PosSat.is_infinite());Sourcepub fn is_nan(self) -> bool
pub fn is_nan(self) -> bool
Whether this carries no information about the value.
use the_q::Q;
assert!(Q::Nan.is_nan());
assert!(!Q::zero().is_nan());Sourcepub fn number(x: Rat) -> Q
pub fn number(x: Rat) -> Q
Lift a kernel rational into the extended type.
use the_q::{Q, Rat};
let half = Rat::new(1, 2).unwrap();
assert_eq!(Q::number(half), Q::Number(half));Sourcepub fn zero() -> Q
pub fn zero() -> Q
0.
use the_q::Q;
assert!(Q::zero().is_zero());
assert!(Q::zero().is_number());Sourcepub fn neg_one() -> Q
pub fn neg_one() -> Q
-1.
use the_q::{Q, Rat};
assert_eq!(Q::neg_one(), Q::Number(Rat::new(-1, 1).unwrap()));Sourcepub fn new(num: i64, den: i64) -> Q
pub fn new(num: i64, den: i64) -> Q
The rational num / den, total: x/0 is ±Inf, 0/0 is Nan.
Saturation is decided on the value (magnitude_fits), not on the
components: 1 / i64::MIN is small and rounds, it does not saturate.
Where Rat::new succeeds this returns the same value.
use the_q::{Q, Rat};
assert_eq!(Q::new(1, 2), Q::Number(Rat::new(1, 2).unwrap()));
assert_eq!(Q::new(1, 0), Q::PosInf);
assert_eq!(Q::new(0, 0), Q::Nan);Sourcepub fn is_zero(self) -> bool
pub fn is_zero(self) -> bool
self == 0.
The result is false for each special value. PosSat denotes
(MAX_MAG, +∞), which does not contain zero, thus false is the true
answer there. For Nan the result is a convention from the design.
use the_q::Q;
assert!(Q::zero().is_zero());
assert!(!Q::PosSat.is_zero());
assert!(!Q::Nan.is_zero());Sourcepub fn is_one(self) -> bool
pub fn is_one(self) -> bool
self == 1.
use the_q::Q;
assert!(Q::one().is_one());
assert!(!Q::PosSat.is_one());Sourcepub fn in_unit_interval(self) -> bool
pub fn in_unit_interval(self) -> bool
0 <= self <= 1.
The result is false for each special value. For the saturations false is
the true answer, because both saturation ranges are outside [0, 1].
use the_q::{Q, Rat};
assert!(Q::number(Rat::new(1, 2).unwrap()).in_unit_interval());
assert!(!Q::PosSat.in_unit_interval());Sourcepub fn signum(self) -> Option<Sign>
pub fn signum(self) -> Option<Sign>
The sign, where one exists.
The result is None for Nan only. Both saturations and both
infinities have a definite sign and give Some. The discriminant
carries that sign for this purpose.
use the_q::{Q, Sign};
assert_eq!(Q::one().signum(), Some(Sign::Positive));
assert_eq!(Q::zero().signum(), Some(Sign::Zero));
assert_eq!(Q::PosSat.signum(), Some(Sign::Positive));
assert_eq!(Q::Nan.signum(), None);Source§impl Q
impl Q
Sourcepub fn sum(xs: &[Q]) -> Q
pub fn sum(xs: &[Q]) -> Q
xs[0] + xs[1] + ..., left to right. An empty slice gives 0.
The left-to-right order is part of the contract and not an implementation detail. With rounding, addition is not associative, thus the order fixes the answer and makes the result reproducible.
use the_q::Q;
let xs = [Q::one(), Q::one(), Q::one()];
assert_eq!(Q::sum(&xs), Q::number(the_q::Rat::new(3, 1).unwrap()));
assert!(Q::sum(&[]).is_zero());Sourcepub fn product(xs: &[Q]) -> Q
pub fn product(xs: &[Q]) -> Q
xs[0] * xs[1] * ..., left to right. An empty slice gives 1.
use the_q::{Q, Rat};
let xs = [Q::number(Rat::new(2, 1).unwrap()), Q::number(Rat::new(3, 1).unwrap())];
assert_eq!(Q::product(&xs), Q::number(Rat::new(6, 1).unwrap()));
assert!(Q::product(&[]).is_one());Sourcepub fn weighted_mean(pairs: &[(Q, Q)]) -> Q
pub fn weighted_mean(pairs: &[(Q, Q)]) -> Q
sum(w_i · x_i) / sum(w_i), total: a zero weight sum gives Nan (0/0)
or a signed infinity, and an empty slice gives Nan the same way.
use the_q::{Q, Rat};
let one = Q::one();
let two = Q::number(Rat::new(2, 1).unwrap());
// weight 1 on `1`, weight 3 on `2`: (1*1 + 3*2) / (1 + 3) == 7/4
let three = Q::number(Rat::new(3, 1).unwrap());
let pairs = [(one, one), (three, two)];
assert_eq!(Q::weighted_mean(&pairs), Q::number(Rat::new(7, 4).unwrap()));
assert!(Q::weighted_mean(&[]).is_nan());Source§impl Q
impl Q
Sourcepub fn add(a: Q, b: Q) -> Q
pub fn add(a: Q, b: Q) -> Q
a + b, total. Replaces the kernel add, which clamps silently.
use the_q::{Q, Rat, MAX_MAG};
assert_eq!(Q::add(Q::one(), Q::one()), Q::number(Rat::new(2, 1).unwrap()));
// Two representable rationals overflowing the budget saturate, they do
// not become infinite.
let m = Q::number(Rat::new(MAX_MAG, 1).unwrap());
assert_eq!(Q::add(m, m), Q::PosSat);
assert!(Q::add(Q::Nan, Q::one()).is_nan());Sourcepub fn sub(a: Q, b: Q) -> Q
pub fn sub(a: Q, b: Q) -> Q
a - b, total.
The definition is a + (-b), as §5 specifies. The two operations thus
agree for an overflowing difference.
use the_q::{Q, Rat};
assert_eq!(Q::sub(Q::one(), Q::one()), Q::zero());
assert!(Q::sub(Q::Nan, Q::zero()).is_nan());Sourcepub fn mul(a: Q, b: Q) -> Q
pub fn mul(a: Q, b: Q) -> Q
a * b, total.
use the_q::Q;
// Saturation denotes a finite real, so zero times it is exactly zero...
assert_eq!(Q::mul(Q::zero(), Q::PosSat), Q::zero());
// ...but zero times a true infinity is the classic indeterminate.
assert!(Q::mul(Q::zero(), Q::PosInf).is_nan());Sourcepub fn pow_u32(self, e: u32) -> Q
pub fn pow_u32(self, e: u32) -> Q
self^e, total. pow_u32(a, 0) is 1 for every a including Nan, as
IEEE NaN^0. A left fold of Q::mul, associating like the kernel.
use the_q::{Q, Rat};
let two = Q::number(Rat::new(2, 1).unwrap());
assert_eq!(two.pow_u32(3), Q::number(Rat::new(8, 1).unwrap()));
assert!(Q::Nan.pow_u32(0).is_one());Sourcepub fn checked_add(a: Q, b: Q) -> Option<Rat>
pub fn checked_add(a: Q, b: Q) -> Option<Rat>
a + b as a Rat, None otherwise. A view over Q::add; cannot panic.
use the_q::{Q, Rat};
assert_eq!(Q::checked_add(Q::one(), Q::one()), Some(Rat::new(2, 1).unwrap()));
assert_eq!(Q::checked_add(Q::PosInf, Q::one()), None);Sourcepub fn checked_sub(a: Q, b: Q) -> Option<Rat>
pub fn checked_sub(a: Q, b: Q) -> Option<Rat>
a - b when the result is a representable rational. See
Q::checked_add.
use the_q::{Q, Rat};
assert_eq!(Q::checked_sub(Q::one(), Q::one()), Some(Rat::zero()));
assert_eq!(Q::checked_sub(Q::Nan, Q::one()), None);Source§impl Q
impl Q
Source§impl Q
impl Q
Sourcepub fn min(a: Q, b: Q) -> Q
pub fn min(a: Q, b: Q) -> Q
The smaller of a and b, propagating Nan; not Ord-based selection.
use the_q::Q;
assert_eq!(Q::min(Q::zero(), Q::one()), Q::zero());
// Unlike `Ord::min`, a `Nan` operand makes the result `Nan`.
assert!(Q::min(Q::Nan, Q::one()).is_nan());Sourcepub fn max(a: Q, b: Q) -> Q
pub fn max(a: Q, b: Q) -> Q
The larger of a and b, propagating Nan. See Q::min.
use the_q::Q;
assert_eq!(Q::max(Q::zero(), Q::one()), Q::one());
assert!(Q::max(Q::Nan, Q::one()).is_nan());Sourcepub fn clamp(a: Q, lo: Q, hi: Q) -> Q
pub fn clamp(a: Q, lo: Q, hi: Q) -> Q
a clamped into [lo, hi]; Nan in any argument, or an inverted range,
gives Nan rather than an endpoint that asserts a false value.
use the_q::{Q, Rat};
let half = Q::number(Rat::new(1, 2).unwrap());
assert_eq!(Q::clamp(half, Q::zero(), Q::one()), half);
let two = Q::number(Rat::new(2, 1).unwrap());
assert_eq!(Q::clamp(two, Q::zero(), Q::one()), Q::one());
// An inverted range has no consistent answer.
assert!(Q::clamp(half, Q::one(), Q::zero()).is_nan());Source§impl Q
impl Q
Sourcepub fn div(a: Q, b: Q) -> Q
pub fn div(a: Q, b: Q) -> Q
a / b, total. Division by zero follows IEEE 754 uniformly, so that
recip(x) == div(one, x) holds at zero. Sat / Inf is exactly 0 and
Inf / Sat a signed infinity, because saturation denotes finite reals.
use the_q::{Q, Rat};
assert_eq!(Q::div(Q::one(), Q::one()), Q::one());
// Division by zero follows IEEE 754: a signed infinity, and `0/0` is `Nan`.
assert_eq!(Q::div(Q::one(), Q::zero()), Q::PosInf);
assert!(Q::div(Q::zero(), Q::zero()).is_nan());Sourcepub fn recip(self) -> Q
pub fn recip(self) -> Q
1 / self, total, defined as div(one, self) (theorem_recip_is_div_one).
Exact on a nonzero Number: swapping a canonical pair cannot round.
use the_q::{Q, Rat};
let two = Q::number(Rat::new(2, 1).unwrap());
assert_eq!(two.recip(), Q::number(Rat::new(1, 2).unwrap()));
assert_eq!(Q::zero().recip(), Q::PosInf);Source§impl Q
impl Q
Sourcepub fn compare(a: Q, b: Q) -> i32
pub fn compare(a: Q, b: Q) -> i32
Three-way comparison: negative, zero or positive as a < b, a == b or
a > b in the order above.
The comparison is total. There is no incomparable pair, because Nan
has a definite position.
use the_q::Q;
assert_eq!(Q::compare(Q::zero(), Q::one()), -1);
assert_eq!(Q::compare(Q::one(), Q::one()), 0);
// `Nan` sorts last, above every other state.
assert_eq!(Q::compare(Q::PosInf, Q::Nan), -1);Sourcepub fn lt(a: Q, b: Q) -> bool
pub fn lt(a: Q, b: Q) -> bool
a < b.
use the_q::Q;
assert!(Q::lt(Q::zero(), Q::one()));
assert!(!Q::lt(Q::one(), Q::one()));Sourcepub fn le(a: Q, b: Q) -> bool
pub fn le(a: Q, b: Q) -> bool
a <= b.
use the_q::Q;
assert!(Q::le(Q::one(), Q::one()));
assert!(!Q::le(Q::one(), Q::zero()));Source§impl Q
impl Q
Sourcepub fn exp(self) -> Q
pub fn exp(self) -> Q
e^self. PosSat above 43.67 (where e^x > MAX_MAG), 0 below
-44; exp(NegSat) is Nan because the image (0, e^-MAX_MAG) does
not contain zero, whereas underflow of a Number is inside R3.
Evaluated by crate::fx::fx_exp_reduced and reassembled here; the
m >= 62 branch keeps results between 2^61 and MAX_MAG numeric.
Accuracy is measured, not proven.
use the_q::Q;
let e2 = Q::new(2, 1).exp();
if let Q::Number(x) = e2 {
assert!((the_q::to_f64(x) - 7.38905609893065).abs() < 1e-9);
} else {
panic!("expected a number");
}
assert_eq!(Q::new(100, 1).exp(), Q::PosSat);Source§impl Q
impl Q
Sourcepub fn ln(self) -> Q
pub fn ln(self) -> Q
The natural logarithm. ln(0) is NegInf; negative and PosSat are
Nan. Binary reduction to m ∈ [1/2, 2], then
ln(m) = 2·atanh((m-1)/(m+1)) with |argument| <= 1/3, plus k·ln 2.
use the_q::Q;
assert_eq!(Q::one().ln(), Q::zero());
assert_eq!(Q::zero().ln(), Q::NegInf);
assert_eq!(Q::new(-1, 1).ln(), Q::Nan);Source§impl Q
impl Q
Sourcepub fn atan(self) -> Q
pub fn atan(self) -> Q
The arctangent in (-π/2, π/2); atan(±∞) = ±π/2, atan(PosSat) is
Nan. Reduced by |x| > 1 → π/2 − atan(1/x) and
|x| > 1/2 → π/4 + atan((x−1)/(x+1)) to |x| <= 1/2 before the series.
use the_q::Q;
use the_q::transcendental::half_pi;
assert_eq!(Q::PosInf.atan(), half_pi());
assert_eq!(Q::PosSat.atan(), Q::Nan);Sourcepub fn sin(self) -> Q
pub fn sin(self) -> Q
The sine. Nan for |x| > 2^20 and for every special. Reduction
r = x − round(x / (π/2)) · π/2, then the series selected by n mod 4.
use the_q::Q;
assert_eq!(Q::zero().sin(), Q::zero());
assert_eq!(Q::new((1i64 << 20) + 1, 1).sin(), Q::Nan);Sourcepub fn cos(self) -> Q
pub fn cos(self) -> Q
The cosine. Same domain and method as Q::sin.
use the_q::Q;
assert_eq!(Q::zero().cos(), Q::one());
assert_eq!(Q::new((1i64 << 20) + 1, 1).cos(), Q::Nan);Sourcepub fn tan(self) -> Q
pub fn tan(self) -> Q
The tangent, as sin/cos.
At an odd multiple of π/2 the cosine is near zero. The quotient then
saturates or gives an infinity, and does not trap. tan has a pole at
those points.
use the_q::Q;
assert_eq!(Q::zero().tan(), Q::zero());
assert_eq!(Q::new((1i64 << 20) + 1, 1).tan(), Q::Nan);Source§impl Q
impl Q
Sourcepub fn log2(self) -> Q
pub fn log2(self) -> Q
The base-2 logarithm. Exact at 2^k and 1 / 2^k for every power of
two a Rat holds (k <= 61; MAX_MAG is 2^62 - 1), where it
returns the integer k (or -k); otherwise
ln(self) / ln(2), whose accuracy is measured, not proven.
Without the exact path log2(8) is a rational within 2^-59 of 3,
not 3: ln(8) mixes the runtime series value of ln 2 with the
stored ln2() literal, and the two differ by one grid unit. The
exponent is found by comparison against the verified power table, so
the exactness is a proven postcondition, not an accident of rounding.
use the_q::Q;
assert_eq!(Q::new(8, 1).log2(), Q::new(3, 1));
assert_eq!(Q::new(1, 1024).log2(), Q::new(-10, 1));
assert_eq!(Q::one().log2(), Q::zero());
// Off the powers of two it is a series result near the true value.
let Q::Number(x) = Q::new(10, 1).log2() else { panic!() };
assert!((the_q::to_f64(x) - 10f64.log2()).abs() < 1e-15);
assert_eq!(Q::zero().log2(), Q::NegInf);Sourcepub fn log10(self) -> Q
pub fn log10(self) -> Q
The base-10 logarithm. Exact at 10^k and 1 / 10^k for k <= 18
(10^18 is the largest power of ten a Rat holds), where it returns
the integer k (or -k); otherwise ln(self) / ln(10), whose
accuracy is measured, not proven. See log2 for why the exact path
exists.
use the_q::Q;
assert_eq!(Q::new(1000, 1).log10(), Q::new(3, 1));
assert_eq!(Q::new(1, 100).log10(), Q::new(-2, 1));
assert_eq!(Q::one().log10(), Q::zero());
let Q::Number(x) = Q::new(2, 1).log10() else { panic!() };
assert!((the_q::to_f64(x) - 2f64.log10()).abs() < 1e-15);Sourcepub fn log(self, base: Q) -> Q
pub fn log(self, base: Q) -> Q
The logarithm in an arbitrary base: log2 when base is exactly 2,
log10 when it is exactly 10 (so their exact paths apply), and
ln(self) / ln(base) otherwise.
A base of 1 gives a zero denominator, thus an infinity or Nan. The
function log_1 is undefined.
use the_q::Q;
assert_eq!(Q::new(8, 1).log(Q::new(2, 1)), Q::new(3, 1));
assert_eq!(Q::new(1000, 1).log(Q::new(10, 1)), Q::new(3, 1));
let Q::Number(x) = Q::new(9, 1).log(Q::new(3, 1)) else { panic!() };
assert!((the_q::to_f64(x) - 2.0).abs() < 1e-15);
assert_eq!(Q::new(8, 1).log(Q::one()), Q::PosInf);Sourcepub fn exp2(self) -> Q
pub fn exp2(self) -> Q
2^self, as exp(self · ln 2).
Accuracy is measured, not proven; the result need not be the exact rational power.
use the_q::Q;
let r = Q::new(3, 1).exp2();
if let Q::Number(x) = r {
assert!((the_q::to_f64(x) - 8.0).abs() < 1e-9);
} else {
panic!("expected a number");
}Sourcepub fn powf(self, exponent: Q) -> Q
pub fn powf(self, exponent: Q) -> Q
self^exponent as exp(exponent · ln(self)): Nan for a negative base
(use Q::pow_i32 for integer exponents); 0^0 is 1.
use the_q::Q;
let r = Q::new(2, 1).powf(Q::new(3, 1));
if let Q::Number(x) = r {
assert!((the_q::to_f64(x) - 8.0).abs() < 1e-9);
} else {
panic!("expected a number");
}
assert_eq!(Q::new(-1, 1).powf(Q::new(2, 1)), Q::Nan);Sourcepub fn cbrt(self) -> Q
pub fn cbrt(self) -> Q
The cube root on the whole real line, as ±exp(ln|x| / 3).
Accuracy is measured, not proven.
use the_q::Q;
let r = Q::new(8, 1).cbrt();
if let Q::Number(x) = r {
assert!((the_q::to_f64(x) - 2.0).abs() < 1e-9);
} else {
panic!("expected a number");
}
assert_eq!(Q::PosSat.cbrt(), Q::Nan);Sourcepub fn hypot(self, other: Q) -> Q
pub fn hypot(self, other: Q) -> Q
sqrt(self² + other²) as |a|·sqrt(1 + (b/a)²) with a the larger, so
the square stays representable when a² + b² does not.
use the_q::Q;
assert_eq!(Q::new(3, 1).hypot(Q::new(4, 1)), Q::new(5, 1));
assert_eq!(Q::zero().hypot(Q::zero()), Q::zero());Sourcepub fn sinh(self) -> Q
pub fn sinh(self) -> Q
(e^x − e^-x) / 2; beyond |x| > 22 it is ±e^(|x| − ln 2) to within the
grid, which saturates cleanly instead of dividing a PosSat by two.
use the_q::Q;
assert_eq!(Q::zero().sinh(), Q::zero());
assert_eq!(Q::new(100, 1).sinh(), Q::PosSat);Sourcepub fn cosh(self) -> Q
pub fn cosh(self) -> Q
The hyperbolic cosine, (e^x + e^-x) / 2, with the same large-argument
path as Q::sinh.
use the_q::Q;
assert_eq!(Q::zero().cosh(), Q::one());
assert_eq!(Q::new(100, 1).cosh(), Q::PosSat);Sourcepub fn tanh(self) -> Q
pub fn tanh(self) -> Q
sinh / cosh; ±1 beyond |x| >= 22 (where 1 − |tanh x| < 2^-62) and
for the infinite and saturated states.
use the_q::Q;
assert_eq!(Q::zero().tanh(), Q::zero());
assert_eq!(Q::new(100, 1).tanh(), Q::one());
assert_eq!(Q::PosInf.tanh(), Q::one());Sourcepub fn asin(self) -> Q
pub fn asin(self) -> Q
The arcsine, in [-π/2, π/2].
The result is Nan outside [-1, 1], where there is no real answer.
The function computes the endpoints directly. The identity below divides
by zero at those two points.
use the_q::Q;
use the_q::transcendental::half_pi;
assert_eq!(Q::one().asin(), half_pi());
assert_eq!(Q::new(2, 1).asin(), Q::Nan);Trait Implementations§
impl Copy for Q
Source§impl<'de> Deserialize<'de> for Q
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Q
serde only.Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Source§impl Div for Q
Total division. The note above states why this operator exists here and not
on Rat.
impl Div for Q
Total division. The note above states why this operator exists here and not
on Rat.
impl Eq for Q
Source§impl From<BigDecimal> for Q
Available on crate feature bigdecimal only.
impl From<BigDecimal> for Q
bigdecimal only.Source§fn from(v: BigDecimal) -> Self
fn from(v: BigDecimal) -> Self
Rounds to nearest; see q_from_bigdecimal.
Source§impl From<BigInt> for Q
Available on crate feature num-bigint only.
impl From<BigInt> for Q
num-bigint only.Source§fn from(v: BigInt) -> Self
fn from(v: BigInt) -> Self
See q_from_bigint.
Source§impl From<Decimal> for Q
Available on crate feature rust_decimal only.
impl From<Decimal> for Q
rust_decimal only.Source§fn from(v: Decimal) -> Self
fn from(v: Decimal) -> Self
Rounds to nearest; see q_from_rust_decimal.
Source§impl From<Ratio<BigInt>> for Q
Available on crate feature num-rational only.
impl From<Ratio<BigInt>> for Q
num-rational only.Source§fn from(v: BigRational) -> Self
fn from(v: BigRational) -> Self
Rounds to nearest; see q_from_big_rational.
Source§impl Ord for Q
impl Ord for Q
Source§fn cmp(&self, other: &Q) -> Ordering
fn cmp(&self, other: &Q) -> Ordering
Delegates to the verified Q::compare. Do not use for selection:
Ord-based min(Nan, Number(5)) asserts the value 5.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Q
impl PartialOrd for Q
Source§impl Serialize for Q
Available on crate feature serde only.A number as the (num, den) pair, a special as its string. Untagged, so
it decodes only in self-describing formats; bincode fails at run time.
impl Serialize for Q
serde only.A number as the (num, den) pair, a special as its string. Untagged, so
it decodes only in self-describing formats; bincode fails at run time.