erikgrinaker / toydb

Distributed SQL database in Rust, written as an educational project
Apache License 2.0
6.12k stars 564 forks source link

fmt::Debug for f64 now uses scientific notation #53

Closed jamesgraves closed 1 year ago

jamesgraves commented 1 year ago

As of at least Rust v1.67.1, fmt::Debug printing of f64 uses scientific notation for sufficiently large / small values.

This code:

let f: f64 = 1.23456789012345e308;
println!("{}", f);
println!("{:?}", f);

prints this:

123456789012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1.23456789012345e308
erikgrinaker commented 1 year ago

Indeed, fixed this as part of a Rust bump. Thanks!