@@ -217,7 +217,7 @@ def __mul__(self, other) -> "Property":
217217 if isinstance (other , Property ):
218218 _other = self ._unit_preconversion (other )
219219 return Property (
220- self .value * _other .value , (self .unit * _other .unit ). simplified ( )
220+ self .value * _other .value , self . _simplify_units (self .unit * _other .unit )
221221 )
222222 raise PropertyBinaryOperationError (
223223 f"cannot multiply { self } with { other } ; "
@@ -268,7 +268,7 @@ def __truediv__(self, other) -> "Property":
268268 raise PropertyBinaryOperationError (
269269 f"cannot divide { self } with { other } ; denominator's value is zero. "
270270 ) from None
271- return Property (value , (self .unit / _other .unit ). simplified ( ))
271+ return Property (value , self . _simplify_units (self .unit / _other .unit ))
272272 raise PropertyBinaryOperationError (
273273 f"cannot divide { self } with { other } ; "
274274 "denominator must be numeric or Property. "
@@ -299,7 +299,7 @@ def __rtruediv__(self, other) -> "Property":
299299 raise PropertyBinaryOperationError (
300300 f"cannot divide { self } with { other } ; denominator's value is zero. "
301301 ) from None
302- return Property (value , (other .unit / self .unit ). simplified ( ))
302+ return Property (value , self . _simplify_units (other .unit / self .unit ))
303303 raise PropertyBinaryOperationError (
304304 f"cannot divide { self } with { other } ; "
305305 "numerator must be numeric or Property. "
@@ -727,3 +727,15 @@ def _simple_unit_preconversion(self, unit: MeasurementUnit) -> MeasurementUnit:
727727 multiplication or division with this property.
728728 """
729729 return self ._dimension_unit_preconversion (unit ** 1 ).unit
730+
731+ def _simplify_units (self , unit : CompositeDimension ) -> UnitDescriptor :
732+ """
733+ Simplifies the composite dimension and returns NON_DIMENSIONAL if the simplified
734+ composite does not have units.
735+ """
736+ unit = unit .simplified ()
737+
738+ if unit .has_no_units ():
739+ return NonDimensionalUnit .NON_DIMENSIONAL
740+
741+ return unit
0 commit comments