Python Forum
decimal - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Bar (https://python-forum.io/forum-27.html)
+--- Thread: decimal (/thread-1572.html)



decimal - Skaperen - Jan-13-2017

you can convert float to decimal but you can't divide a decimal by a float.  anyone know why that is?


RE: decimal - wavic - Jan-13-2017

Why do you want to divide decimal to float? If you need a precision try gmpy2
https://gmpy2.readthedocs.io/en/latest/mpfr.html


RE: decimal - Skaperen - Jan-13-2017

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.