decimal.Decimal formatting

python at lists.fastmail.net python at lists.fastmail.net
Mon Jul 19 08:32:06 EDT 2010


I have various decimals which eventually are written to an XML file.
Requirements indicate a precision of 11. I am currently having some
'issues' with Decimal("0"). When using
quantize(decimal.Decimal("1e-11")) the result is not 0.00000000000, but
1e-11.

Personally I agree 1e-11 is a better notation than 0.00000000000, but I
currently need the long one. Is there a way to overwrite the switch to
the scientific notation? Apparently there is a switch in notation
'between' 1e-6 and 1e-7.

Thijs



More information about the Python-list mailing list