summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/value.cc9
-rwxr-xr-xtests/dumptest4
-rwxr-xr-xtests/echotest4
3 files changed, 6 insertions, 11 deletions
diff --git a/src/value.cc b/src/value.cc
index ebb825d..8320aff 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -182,12 +182,15 @@ public:
}
std::string operator()(const double &op1) const {
-#ifdef OPENSCAD_TESTING
- // Quick and dirty hack to work around floating point rounding differences
- // across platforms for testing purposes.
if (op1 != op1) { // Fix for avoiding nan vs. -nan across platforms
return "nan";
}
+ if (op1 == 0) {
+ return "0"; // Don't return -0 (exactly -0 and 0 equal 0)
+ }
+#ifdef OPENSCAD_TESTING
+ // Quick and dirty hack to work around floating point rounding differences
+ // across platforms for testing purposes.
std::stringstream tmp;
tmp.precision(12);
tmp.setf(std::ios_base::fixed);
diff --git a/tests/dumptest b/tests/dumptest
index 180fa1b..0c60099 100755
--- a/tests/dumptest
+++ b/tests/dumptest
@@ -4,8 +4,4 @@ openscad $1 -o $2
sed 's/, timestamp = [0-9]*//' -i $2
-sed 's/-nan/nan/g' -i $2
-
-sed 's/-\(0[],)]\)/\1/g' -i $2
-
sed 's/-\?[0-9].[0-9]*e-[0-9]\{2,\}/0/g' -i $2
diff --git a/tests/echotest b/tests/echotest
index 2ca520c..9e29878 100755
--- a/tests/echotest
+++ b/tests/echotest
@@ -2,8 +2,4 @@
openscad $1 -o null 2> $2
-sed 's/-nan/nan/g' -i $2
-
-sed 's/-\(0[],)]\)/\1/g' -i $2
-
sed 's/-\?[0-9].[0-9]*e-[0-9]\{2,\}/0/g' -i $2
contact: Jan Huwald // Impressum