Python Forum

Full Version: decimal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
you can convert float to decimal but you can't divide a decimal by a float.  anyone know why that is?
Why do you want to divide decimal to float? If you need a precision try gmpy2
https://gmpy2.readthedocs.io/en/latest/mpfr.html
just initializing some decimal.Decimal values and one of them needed to be a ratio of another, initially, and that ratio was a float even though its actual value was whole, initially, e,g rat = 5.0, so foo = foobar/rat failed and foo = foobar/decimal.Decimal(rat) got around it.