Expand description
JavaScript-compatible number parsers and formatters.
Functions§
- format_
number_ js - ECMAScript ToString for f64 — spells NaN/Infinity/-Infinity and normalizes -0 to “0” (Rust’s default prints “inf” and keeps the sign).
- parse_
float_ js - parse_
int_ js - JS-spec
parseInt(s, radix)for an already-converted radix. - parse_
int_ with_ radix parseInt(s, radix)with the radix argument as JavaScript reads it:ToInt32, where 0 (includingNaNand an omitted radix) means “detect a0xprefix, else base 10”. Any other value outside 2–36 makes the resultNaN.- string_
to_ number_ js - JS-spec
Number(s)/ToNumberon a string. - to_
exponential_ js - JS-spec
Number#toExponential(fractionDigits). A NaNfractionDigitsis the omitted-argument sentinel: use however many digits uniquely identify the value. - to_
fixed_ js - JS-spec
Number#toFixed(digits). - to_
precision_ js - JS-spec
Number#toPrecision(precision). A NaNprecisionis the omitted-argument sentinel: behave like plaintoString. - to_
string_ radix_ js - JS-spec
Number#toString(radix)for radix 2–36.