Skip to content
New issue

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

Decimal option crashes Quantity constructor #2068

Open
XZF0 opened this issue Oct 26, 2024 · 0 comments
Open

Decimal option crashes Quantity constructor #2068

XZF0 opened this issue Oct 26, 2024 · 0 comments

Comments

@XZF0
Copy link

XZF0 commented Oct 26, 2024

import pint
import decimal
ureg = pint.UnitRegistry(non_int_type=decimal.Decimal) 
y = ureg.Quantity('1.2345', 'm')
print(y.to('cm'))
#>>> TypeError: can't multiply sequence by non-int of type 'decimal.Decimal'

ureg = pint.UnitRegistry(non_int_type=decimal.Decimal) 
y = ureg.Quantity(1.2345, 'm')
print(y.to('cm'))
#>>> TypeError: unsupported operand type(s) for *: 'float' and 'decimal.Decimal'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant