mirror of https://github.com/vitalif/openscad
commit
83879ab41c
|
@ -198,7 +198,12 @@ public:
|
|||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue