pub fn write_resp_float(f: f64, out: &mut Vec<u8>)Expand description
A double, the way JSON.RESP writes one, which is not the way JSON does.
Redis has one routine for turning a double into text outside of JSON and
JSON.RESP goes through it rather than through the JSON writer, so the
digits are not the digits JSON.GET hands back for the same number. Three
things differ. A whole number a long long can hold comes back as that long
long, so 1.0 is 1 and 1e16 is 10000000000000000. The switch to
exponent form is at 1e-7 below and depends on the digit count above rather
than sitting at 1e16. And a positive exponent carries a +, so 1e19 is
1e+19 while 1e-7 stays 1e-7.
The shape rules below are grisu2’s as Redis links it. Redis will not always answer the shortest digits there and Rust always will, which is a difference of one digit on roughly one number in a thousand and is not worth carrying a second digit generator for.