Skip to content
Browse files

Merge branch 'master' into lion

  • Loading branch information...
2 parents 2291995 + 83879ab commit f07e2984a9a589c05e513c91562ad516e28f26bf @kintel kintel committed
Showing with 11 additions and 1 deletion.
  1. +6 −1 src/value.cc
  2. +4 −0 testdata/scad/misc/echo-tests.scad
  3. +1 −0 tests/regression/echotest/echo-tests-expected.txt
View
7 src/value.cc
@@ -199,7 +199,12 @@ class tostring_visitor : public boost::static_visitor<std::string>
}
return tmpstr;
#else
- return boost::lexical_cast<std::string>(op1);
+ // attempt to emulate Qt's QString.sprintf("%g"); from old OpenSCAD.
+ // see https://github.com/openscad/openscad/issues/158
+ std::stringstream tmp;
+ tmp.unsetf(std::ios::floatfield);
+ tmp << op1;
+ return tmp.str();
#endif
}
View
4 testdata/scad/misc/echo-tests.scad
@@ -12,3 +12,7 @@ echo(vec = [1,2,3]);
echo(range = [0:2]);
echo(str("string generated by str()"));
+
+// https://github.com/openscad/openscad/issues/158 rept by nop head
+// 0.8 should print 0.8 not 0.80000...004 (regardless of internal representation)
+echo(0.8);
View
1 tests/regression/echotest/echo-tests-expected.txt
@@ -7,3 +7,4 @@ ECHO: [1 : 2 : 10]
ECHO: vec = [1, 2, 3]
ECHO: range = [0 : 1 : 2]
ECHO: "string generated by str()"
+ECHO: 0.8

0 comments on commit f07e298

Please sign in to comment.
Something went wrong with that request. Please try again.