mirror of
				https://github.com/rm-dr/daisy
				synced 2025-10-31 06:24:36 -07:00 
			
		
		
		
	Fixed unit tobase() conversion
This commit is contained in:
		| @ -52,11 +52,11 @@ impl FreeUnit { | |||||||
|  |  | ||||||
| 	// Get this unit in terms of base units | 	// Get this unit in terms of base units | ||||||
| 	pub fn to_base(&self) -> Quantity { | 	pub fn to_base(&self) -> Quantity { | ||||||
| 		let q = self.whole.base_factor(); | 		let f = self.to_base_factor(); | ||||||
| 		let mut q = q.unwrap_or(Quantity::new_rational_from_string("1").unwrap()); |  | ||||||
|  |  | ||||||
| 		// Don't divide by self | 		let mut q = Quantity::new_rational_from_string("1").unwrap(); | ||||||
| 		q.insert_unit(FreeUnit::from_whole_prefix(self.whole, self.prefix), Scalar::new_rational(1f64).unwrap()); | 		q.insert_unit(FreeUnit::from_whole_prefix(self.whole, self.prefix), Scalar::new_rational(1f64).unwrap()); | ||||||
|  | 		q.mul_assign_no_convert(f); | ||||||
|  |  | ||||||
| 		return q; | 		return q; | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user