We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pint 0.24.3
I would expect that when converting from say 1 lb to 16 oz and then back to lb would be equivalent, but it doesn't seem to be the case:
1 lb
16 oz
lb
In [21]: from pint import UnitRegistry In [22]: ureg = UnitRegistry() In [23]: (1 * ureg.lb).to(ureg.oz) Out[23]: <Quantity(16.0, 'ounce')> In [24]: (1 * ureg.lb).to(ureg.oz) == 16 * ureg.oz Out[24]: False In [25]: (1 * ureg.lb).to(ureg.oz) == 16.0 * ureg.oz Out[25]: False
It appears that it might have to do with floating point precision:
In [28]: (1 * ureg.lb).to(ureg.oz).magnitude Out[28]: 16.000000000000004
Is this the expected behavior?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
pint 0.24.3
I would expect that when converting from say
1 lb
to16 oz
and then back tolb
would be equivalent, but it doesn't seem to be the case:It appears that it might have to do with floating point precision:
Is this the expected behavior?
The text was updated successfully, but these errors were encountered: