fmt_num

Function fmt_num 

Source
pub fn fmt_num(v: f64) -> String
Expand description

Format an f64 without noisy trailing zeros (1.0 -> 1, 1.50 -> 1.5), and otherwise with the shortest digits that parse back to the same value (what JS String(n) shows for the same value in the ranges that matter).

The digits must round-trip: no fixed decimal count, so a small nonzero never reads as 0. Integral values below 1e15 print as integers.