I'm trying to modify some library and I need to store a float value in a ptree. However when I retrieve the value it's different from what I've put in there. This doesn't happen with doubles. Example:
Ptree pt;
float f = 230518.391;
pt.put("float", f);
pt.put("double", (double) f)
cout << "f: " << f;
cout << "pt.float: " << pt.get<float>("float");
cout << "pt.double: " << pt.get<double>("double");
Output: f: 230518.391 pt.float: 230518.406 pt.double: 230518.391
What the hell is happening here?