Minor fixes

This commit is contained in:
2023-04-01 18:27:47 -07:00
parent cb227d9539
commit f07ba9ed38
3 changed files with 11 additions and 7 deletions

View File

@ -116,10 +116,10 @@ impl Quantity {
}
}
pub fn new_rational_from_string(s: &str) -> Quantity {
return Quantity::Rational {
v: RationalQ::from_string(s)
}
pub fn new_rational_from_string(s: &str) -> Option<Quantity> {
let r = RationalQ::from_string(s);
if r.is_none() { return None; }
return Some(Quantity::Rational { v: r.unwrap() });
}
pub fn new_rational_from_f64(f: f64) ->