Fixed a small bug that caused _Quantity.to_compact to fail when magnitude is 0

This commit is contained in:
Emilien Kofman 2016-01-15 11:34:58 +01:00
parent 4dd7413dc6
commit 5a7e57ad30

View File

@ -317,7 +317,7 @@ class _Quantity(SharedRegistryObject):
>>> (1e-2*ureg('kg m/s^2')).to_compact('N') >>> (1e-2*ureg('kg m/s^2')).to_compact('N')
<Quantity(10.0, 'millinewton')> <Quantity(10.0, 'millinewton')>
""" """
if self.unitless: if self.unitless or self.magnitude==0:
return self return self
SI_prefixes = {} SI_prefixes = {}