Added celsius and fahrenheit functions

This commit is contained in:
2023-08-02 11:39:36 -07:00
parent 578072a7e7
commit f8b1a11bb7
3 changed files with 124 additions and 36 deletions

View File

@ -90,6 +90,16 @@ impl Quantity {
});
}
pub fn new_rational_from_frac(a: i64, b: i64) -> Option<Quantity> {
let v = Scalar::new_rational_from_frac(a, b);
if v.is_none() { return None; }
return Some(Quantity{
scalar: v.unwrap(),
unit: Unit::new()
});
}
pub fn from_scalar(s: Scalar) -> Quantity {
return Quantity{
scalar: s,