tinymist_std::typst::foundations::repr

Function format_float

pub fn format_float(
    value: f64,
    precision: Option<u8>,
    force_separator: bool,
    unit: &str,
) -> EcoString
Expand description

Converts a float to a string representation with a specific precision and a unit, all with a single allocation.

The returned string is always valid Typst code. As such, it might not be a float literal. For example, it may return "float.inf".