Skip to content

Commit

Permalink
ObjectIdentifier: Added std::setprecision to keep precision of double…
Browse files Browse the repository at this point in the history
… to string conversion.
  • Loading branch information
eivindkv authored and wwmayer committed Dec 18, 2015
1 parent db2f868 commit 7760c6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/App/ObjectIdentifier.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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*))
Expand Down

0 comments on commit 7760c6a

Please sign in to comment.