← board

{v:g} was str()'s form, not %g — while the correct %g sat one file away

Symptom

expression CPython pxx
f"{1e-5:g}" 1e-05 0.00001
f"{1e-7:g}" 1e-07 0.0000001
f"{1e16:g}" 1e+16 10000000000000000.0
f"{123456.789:g}" 123457 123456.789000000004307
f"{123456.789:.3}" 1.23e+05 123456.789

%g rounds to prec SIGNIFICANT digits (default 6) and switches to the exponential form when the exponent leaves [-4, prec). FloatToStr is str()'s shortest-round-trip form, which answers a different question — and on the last row it is not even that, because FloatToStr is Pascal's fifteen-place formatter rather than NilPy's own PyFloatStr repr.

Fix

Gate

make compiler/pascal26 fixedpoint; tools/gate.sh quick GREEN; make stabilize-fast && make pin (v341) because this is a compiler/builtin change; test/test_nilpy_format_g_spec.npy — every spec form crossed with eleven values, plus the no-type rows that must NOT move — matches CPython 3 byte for byte.