Import with #import "std/float_text".

ParseFloat64 :: (text: string) -> (float64, bool)

A complete ASCII decimal, optional sign/point/exponent, or inf/nan. No whitespace, separators or trailing bytes. Invalid input returns 0,false. Overflow and underflow succeed, producing infinity or signed zero.

Float64Repr :: (value: float64) -> Text

Python-style shortest binary64 repr: fixed for decimal orders -4..15, otherwise lowercase e, explicit exponent sign and at least two digits. Finite integral values retain .0; signed zero, inf and nan are preserved. The returned string owns its storage.

Float64ReprInto :: (value: float64, output: *Vec(u8)) -> bool

Append one representation to caller-owned storage. Reserve before writing so an allocation rejection leaves the prior output unchanged.

Source ↗ · All modules