The floor and ceil functions overflow too easily. Below is an example:
use num_rational::Ratio; // 0.4.2
fn main() {
let frac = Ratio::<i8>::new(70, 81);
println!("ceil({frac}) = ");
println!("{}", frac.ceil());
}
Unrelated: It seems odd that there are several functions that return integers as Ratio<T> instead of the T.
The
floorandceilfunctions overflow too easily. Below is an example:Unrelated: It seems odd that there are several functions that return integers as
Ratio<T>instead of theT.