Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use num_bigint::{BigInt, BigUint, Sign, ToBigInt};
use num_integer::Integer;
use num_traits::float::FloatCore;
use num_traits::{
bounds::{LowerBounded, UpperBounded},
Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, ConstOne, ConstZero, FromPrimitive,
Inv, Num, NumCast, One, Pow, Signed, ToPrimitive, Unsigned, Zero,
};
Expand Down Expand Up @@ -425,6 +426,18 @@ impl<T: Clone + Integer + Hash> Hash for Ratio<T> {
}
}

impl<T: LowerBounded + Clone + Integer> LowerBounded for Ratio<T> {
fn min_value() -> Self {
Self::from_integer(T::min_value())
}
}

impl<T: UpperBounded + Clone + Integer> UpperBounded for Ratio<T> {
fn max_value() -> Self {
Self::from_integer(T::max_value())
}
}

mod iter_sum_product {
use crate::Ratio;
use core::iter::{Product, Sum};
Expand Down