pub fn number_to_string(value: f64) -> StringExpand description
ToString applied to a number.
Defined in quickjs-compile and re-exported here, because the compiler needs the
same string for a numeric property key — get 0.0000001() {} binds the key "1e-7" —
and two copies of the exponent thresholds are two things that can drift. The tests for
it live next to the definition.
ToString applied to a number.
The thresholds are the ones the spec’s Number::toString uses: exponential form below
1e-6 and from 1e21 up, decimal form in between. Within the decimal range Rust’s
shortest-round-trip formatter already agrees with JavaScript digit for digit — including
the notorious 0.30000000000000004 — so only the exponent spelling has to be
normalised.