yaml-cpp icon indicating copy to clipboard operation
yaml-cpp copied to clipboard

Floating-point numbers are uglified, a.k.a. write shortest floating-point representation with round-trip guarantee

Open Anton3 opened this issue 8 months ago • 23 comments

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:

latitude: 34.34
longitude: 56.56
altitude: 12.12
heading: 78.78

After:

latitude: 34.340000000000003
longitude: 56.560000000000002
altitude: 12.119999999999999
heading: 78.780000000000001

Anton3 avatar Jun 23 '24 18:06 Anton3