yaml-cpp
yaml-cpp copied to clipboard
Emitting Float With Trailing Decimal .0
trafficstars
Currently any float/double with no decimal component gets emitted as an integer.
float a = 1.0;
YAML::Emitter emitter;
// regardless of the Precision manipulator
emitter << YAML::Precision(2) << a;
// outputs 1
Is there a way to make it output 1.0?
The YAML file I'm emitting should have a mix of ints and floats, which gets parsed by an external script. That script needs to be able to distinguish floats and ints.
Did you ever find a solution for this? I am facing the same problem