Boost::propertytree DBL_MAX
-
I'm programming a ptree and at some point I need to put DBL_MAX in (as a default value). I see the right number when I open the generated xml-file.
But when I use ptree.get to get the number an exception is thrown:conversion of data to type "d" failed.
Is there a way to get the number from the property tree?
can anybody help me with that?#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> #include "float.h" using namespace std; int main() { using boost::property_tree::ptree; ptree pt; double d=-DBL_MAX; double d2=-1.797693134862316e+308; double d3=-1.79769e+308; cout<<d<<endl; cout<<d2<<endl; cout<<d3<<endl; pt.put<double>("double", d); write_xml("test.xml", pt); cout << "from xml-file: " <<pt.get<double>("double")<<endl;//doesn't work with d and d2, but works with d3 }