Python Decimal doesn\'t support being constructed from float; it expects that you have to convert float to a string first.
This is very inconvenient since standard
"%.15g" % f
Or in Python 3.0:
format(f, ".15g")
Just pass the float to Decimal constructor directly, like this:
Decimal
from decimal import Decimal Decimal(f)