intcomma() returns scientific notation for floats of 1e16 and above, with no commas added:
>>> humanize.intcomma(1e15)
'1,000,000,000,000,000.0'
>>> humanize.intcomma(1e16)
'1e+16'
>>> humanize.intcomma(1.5e20)
'1.5e+20'
I expected '10,000,000,000,000,000.0' and '150,000,000,000,000,000,000.0'. Passing ndigits works around it (intcomma(1e16, 0) gives '10,000,000,000,000,000').
This happens because f"{value:,}" on a float uses the same formatting as repr(), and that switches to an exponent at 1e16. Small floats hit the same thing, e.g. intcomma(0.00001) returns '1e-05'.
intcomma()returns scientific notation for floats of 1e16 and above, with no commas added:I expected
'10,000,000,000,000,000.0'and'150,000,000,000,000,000,000.0'. Passingndigitsworks around it (intcomma(1e16, 0)gives'10,000,000,000,000,000').This happens because
f"{value:,}"on a float uses the same formatting asrepr(), and that switches to an exponent at 1e16. Small floats hit the same thing, e.g.intcomma(0.00001)returns'1e-05'.