I have a string that I need to convert to a float for me to work on.
num = "2.769999999999999574e+00"
If I do a float operation, the precision is gone
print(float(num)) # 2.7699999999999996
If I use a Decimal class ,even then the precision is gone
from decimal import Decimal
print(Decimal(num)) # 2.769999999999999574
It seems Decimal is only able to retain the precision if the number supplied is a float in the first place
print(Decimal(2.769999999999999574e+00)) # 2.769999999999999573674358543939888477325439453125
How do I maintain precision while converting a number from string to float?