summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-11-24 22:10:46 (GMT)
committerMarius Kintel <marius@kintel.net>2011-11-24 22:10:46 (GMT)
commit42d709908950790302f2f0bfc24267b77d6716c0 (patch)
treedf1eae5dabb2f2aecfaba217e65d727a16c032c8 /src/value.cc
parent3f0a991a3da991ce9672fe92cffa157e194abab9 (diff)
Attempt to batte floating point rounding differences for testing purposes
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index ab78c2a..5ea766c 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -363,7 +363,20 @@ std::string Value::toString() const
<< ']';
break;
case NUMBER:
+#ifdef OPENSCAD_TESTING
+ // Quick and dirty hack to work around floating point rounding differences
+ // across platforms for testing purposes.
+ {
+ std::stringstream tmp;
+ tmp.precision(16);
+ tmp << this->num;
+ std::string tmpstr = tmp.str();
+ if (tmpstr.size() > 16) tmpstr.erase(16);
+ stream << tmpstr;
+ }
+#else
stream << this->num;
+#endif
break;
case BOOL:
stream << (this->b ? "true" : "false");
contact: Jan Huwald // Impressum