ObjectIdentifier: Added std::setprecision to keep precision of double to string conversion.

This commit is contained in:
Eivind Kvedalen 2015-12-11 01:52:55 +01:00 committed by wmayer
parent db2f868bbe
commit 7760c6ac18

View File

@ -26,6 +26,9 @@
# include <cassert>
#endif
#include <limits>
#include <iomanip>
/// Here the FreeCAD includes sorted by Base,App,Gui......
#include "Property.h"
#include "Application.h"
@ -912,9 +915,9 @@ void ObjectIdentifier::setValue(const boost::any &value) const
ss << getPythonAccessor() + " = ";
if (value.type() == typeid(Base::Quantity))
ss << boost::any_cast<Base::Quantity>(value).getValue();
ss << std::setprecision(std::numeric_limits<double>::digits10 + 1) << boost::any_cast<Base::Quantity>(value).getValue();
else if (value.type() == typeid(double))
ss << boost::any_cast<double>(value);
ss << std::setprecision(std::numeric_limits<double>::digits10 + 1) << boost::any_cast<double>(value);
else if (value.type() == typeid(char*))
ss << '\'' << Base::Tools::escapedUnicodeFromUtf8(boost::any_cast<char*>(value)) << '\'';
else if (value.type() == typeid(const char*))