Skip to content

Commit

Permalink
Merge branch 'master' into lion
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Aug 2, 2012
2 parents 2291995 + 83879ab commit f07e298
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/value.cc
Expand Up @@ -199,7 +199,12 @@ class tostring_visitor : public boost::static_visitor<std::string>
} }
return tmpstr; return tmpstr;
#else #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 #endif
} }


Expand Down
4 changes: 4 additions & 0 deletions testdata/scad/misc/echo-tests.scad
Expand Up @@ -12,3 +12,7 @@ echo(vec = [1,2,3]);
echo(range = [0:2]); echo(range = [0:2]);


echo(str("string generated by str()")); 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);
1 change: 1 addition & 0 deletions tests/regression/echotest/echo-tests-expected.txt
Expand Up @@ -7,3 +7,4 @@ ECHO: [1 : 2 : 10]
ECHO: vec = [1, 2, 3] ECHO: vec = [1, 2, 3]
ECHO: range = [0 : 1 : 2] ECHO: range = [0 : 1 : 2]
ECHO: "string generated by str()" ECHO: "string generated by str()"
ECHO: 0.8

0 comments on commit f07e298

Please sign in to comment.