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:
Rationals,
"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 Rationals {}
impl Negative for Rationals {}
impl Zero for Rationals {
#[inline]
fn new_zero() -> Self {
Rational8::new_zero().into()
}
}
impl One for Rationals {
#[inline]
fn new_one() -> Self {
Rational8::new_one().into()
}
}
impl NegOne for Rationals {
#[inline]
fn new_neg_one() -> Self {
Rational8::new_neg_one().into()
}
}
impl ConstZero for Rationals {
const ZERO: Self = Rationals::_8(Rational8::ZERO);
}
impl ConstOne for Rationals {
const ONE: Self = Rationals::_8(Rational8::ONE);
}
impl ConstNegOne for Rationals {
const NEG_ONE: Self = Rationals::_8(Rational8::NEG_ONE);
}
impl LowerBounded for Rationals {
#[inline]
fn new_min() -> Self {
Rational8::new_min().into()
}
}
impl UpperBounded for Rationals {
#[inline]
fn new_max() -> Self {
Rational128::new_max().into()
}
}
impl ConstLowerBounded for Rationals {
const MIN: Self = Rationals::_128(Rational128::MIN);
}
impl ConstUpperBounded for Rationals {
const MAX: Self = Rationals::_128(Rational128::MAX);
}