Skip to main content

format_number

Function format_number 

Source
pub fn format_number(value: f64) -> String
Expand description

Format a float like the reference frontend: integers print without a decimal point, and non-integers print the shortest round-trip representation truncated to 16 significant digits (OverPy behavior; evidence: the pinned oracle snapshots). A non-integer keeps its shortest representation when truncation would make the emitted value integral. Non-finite values take the reference’s String(n) spellings Infinity, -Infinity, and NaN (pinned OverPy 9.7.10 emission for log(0) and log(-1) folds; #358). These spellings are emission-only: without Workshop client-acceptance evidence the canonical grammar admits no non-finite literal, and wir validation rejects non-finite number values.