Floating point "g" format not stripping trailing zeros

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Feb 13 22:22:57 EST 2015


Mark Lawrence wrote:
> I still think it's a bug as the 'p' being referred to in the OP's 
> original message is "The precision is a decimal number indicating how 
> many digits should be displayed after the decimal point for a floating 
> point value formatted with 'f' and 'F', or before and after the decimal 
> point for a floating point value formatted with 'g' or 'G'".  In other 
> words is has nothing to do with the precision of the underlying number.

But it does say that "insignificant trailing
zeros are removed", not just "trailing zeros
are removed".

However, it's possible that "insignificant"
was just intended to mean "after the decimal
point". The specification is a bit vague.

-- 
Greg



More information about the Python-list mailing list