Skip to main content

format_float_limited

Function format_float_limited 

Source
fn format_float_limited(buf: &mut BytesMut, f: f64, ndig: i32) -> Nestable
Expand description

Formats f with ndig significant digits like C’s %.*g, mirroring PostgreSQL’s float4out/float8out when extra_float_digits is zero or negative. Like PostgreSQL, ndig values below 1 are clamped to 1, and non-finite values are spelled NaN, Infinity, and -Infinity.