pull/2/head
Mark 2023-07-28 09:37:10 -07:00
parent be043af4f0
commit a76af3c69a
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 3 additions and 0 deletions

View File

@ -154,6 +154,7 @@ impl Unit {
}
// True if base units are the same
// compatible <=> can be converted to
pub fn compatible_with(&self, other: &Unit) -> bool {
let s = self.clone() * self.to_base_factor().unit;
let o = other.clone() * other.to_base_factor().unit;
@ -183,6 +184,7 @@ impl Unit {
return u;
}
// Returns a unit `u` so that `self * u` contains only base units.
pub fn to_base_factor(&self) -> Quantity {
let mut q = Quantity::new_rational(1f64).unwrap();
@ -194,6 +196,7 @@ impl Unit {
return q;
}
// Returns a unit `u` equivalent to `self` that contains only base units.
pub fn to_base(&self) -> Quantity {
let mut q = Quantity::new_rational(1f64).unwrap();