Just use the float() function to convert decimal to float in Python. Or you can use float_number = decimal_number * 1.0
formula.
number_in_float = float(number_you_have)
Python decimal to float example
Simple example code. (dec * decimal.Decimal(1.0))
is not working for us.
import decimal
dec = decimal.Decimal('10')
print(dec)
print(type(dec))
f = float(dec)
print(f)
print(type(f))
res = (dec * decimal.Decimal(1.0))
print(res)
Output:
Do comment if you have any doubts or suggestions on this Python conversion topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.