Skip to content

Fmt

Source: std/fmt.mw.

Number formatting, written in Marrow (no libc printf). Every function writes into a caller-provided buffer and returns the number of bytes written; no NUL terminator is added. 64 bytes are always enough.

fn fmt_reverse(buf: *u8, len: i64)
fn fmt_u64(buf: *u8, n: u64, base: i64) -> i64

Unsigned integer in the given base (2..16), lowercase digits.

fn fmt_i64(buf: *u8, n: i64) -> i64
fn fmt_pow10(n: i64) -> u64
fn fmt_copy_str(buf: *u8, s: *u8) -> i64
fn fmt_f64(buf: *u8, x: f64, decimals: i64) -> i64

Fixed-point notation with decimals digits after the point (0..15). Values of 1e15 and above use scientific notation (d.dddddde+XX).