Hello Boost guys,
when I switched from Boost 1.55 to 1.57 there was a change in the
formation of floats and doubles for xml archives. Look at this example:
#include <fstream>
#include
class MyClass
{
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & boost::serialization::make_nvp("accuracy", accuracy);
}
double accuracy = 0.03;
};
int main()
{
MyClass obj;
std::ofstream ofs("sample.xml");
boost::archive::xml_oarchive oa(ofs);
oa & boost::serialization::make_nvp("myclass", obj);
}
I compiled it with VS 2013 for 32 bit. The output file has the line:
2.99999999999999990e-002
In Boost 1.55 it was much better human-readable: 0.03.
Is this behaviour (this change) intended? In any case, what is the best
way to format floats and doubles? (i. e. a manipulator for the ofstream?)
Thanks,
Frank
--
Frank Stähr
Technische Universität Berlin
Communication Systems Group
Sekr. EN1 Einsteinufer 17
10587 Berlin, Germany