use super::{
super::family::define_rational_family, Rational128, Rational16, Rational32, Rational64,
Rational8,
};
use crate::number::traits::{
ConstLowerBounded, ConstNegOne, ConstOne, ConstUpperBounded, ConstZero, LowerBounded, NegOne,
Negative, One, Positive, UpperBounded, Zero,
};
define_rational_family![build_variants:
Rational,
"The family of [rational][super] numbers, also known as [`Q`][super::Q].",
common:
Rational+8, Rational+16, Rational+32, Rational+64, Rational+128
;
depending:
Big, RationalBig, "---"
];
impl Positive for Rational {}
impl Negative for Rational {}
impl Zero for Rational {
#[inline]
fn new_zero() -> Self {
Rational8::new_zero().into()
}
}
impl One for Rational {
#[inline]
fn new_one() -> Self {
Rational8::new_one().into()
}
}
impl NegOne for Rational {
#[inline]
fn new_neg_one() -> Self {
Rational8::new_neg_one().into()
}
}
impl ConstZero for Rational {
const ZERO: Self = Rational::_8(Rational8::ZERO);
}
impl ConstOne for Rational {
const ONE: Self = Rational::_8(Rational8::ONE);
}
impl ConstNegOne for Rational {
const NEG_ONE: Self = Rational::_8(Rational8::NEG_ONE);
}
impl LowerBounded for Rational {
#[inline]
fn new_min() -> Self {
Rational8::new_min().into()
}
}
impl UpperBounded for Rational {
#[inline]
fn new_max() -> Self {
Rational128::new_max().into()
}
}
impl ConstLowerBounded for Rational {
const MIN: Self = Rational::_128(Rational128::MIN);
}
impl ConstUpperBounded for Rational {
const MAX: Self = Rational::_128(Rational128::MAX);
}