Skip to main content

push_double

Function push_double 

Source
pub fn push_double(out: &mut Vec<u8>, d: f64)
Expand description

Appends a double the way Redis 8 writes one.

This is d2string. Redis stopped using %.17g in 7.0 and now writes a double in two cases: a value that is exactly an integer inside two to the sixty second is written with the integer printer, and everything else goes through the Grisu2 in crate::dtoa. Zero is checked before either of them, which is the only reason negative zero comes back as -0 rather than as 0.

The infinities and NaN are written as bare words because that is what RESP3 says and what RESP2 clients have always been given.