Open Anton3 opened 1 week ago
+1 I am running into this issue too. Emitting a float
678.9 results in 678.900024, and emitting a double
890.1 results in 890.10000000000002.
@jbeder Can you take a look?
This sounds reasonable, open to PRs. But you'll have to be careful about the API here, you don't want unintended consequences.
In the last few years, libraries like
fmt
have mastered printing of floating-point numbers. They use shortest representation with round-trip guarantee.Meanwhile, yaml-cpp, after #649, started to uglify numbers in my configs (I use yaml-cpp to patch them).
For example, before:
After: