kdl-rs icon indicating copy to clipboard operation
kdl-rs copied to clipboard

Custom float printer for consistent default float printing

Open zkat opened this issue 2 years ago • 0 comments

Currently, we pretty much just throw floats at format!("{:?}") and call it a day.

Unfortunately, this yields different results depending on Rust version (for example, 1.56 vs 1.60, so not even a big gap!).

So, we need to write our own that will follow a predictable pattern. Then we'll be able to re-enable the underscored tests that deal with floating point numbers that would otherwise fail.

Ideally, this formatter will be pretty smart about formatting exponent form (1.0e-10 etc), so the numbers also look nice, not just be correct.

zkat avatar Apr 28 '22 06:04 zkat