pub fn cppnix_format_float(f: f64) -> StringExpand description
Format a f64 the way CppNix does — printf("%g", f) semantics
with 6 significant digits, trailing-zero strip, no decimal point
for whole numbers.
Examples matching nix eval byte-for-byte (verified on cppnix
2.30 / cid 2026-05-23):
1.0 / 3.0→"0.333333"10.0 / 3.0→"3.33333"(6 sig digits, not 6 decimal places)3.14159→"3.14159"12.345→"12.345"1.5→"1.5"3.0→"3"5.0 - 2.0→"3"0.0→"0"0.0001→"0.0001"NaN→"NaN"inf→"inf"
Used by every engine’s float Display impl (Value::Float,
VMValue::Float, StringKeyedValue::Float) so probe JSON
round-trips byte-identically against cppnix.