aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-09 21:47:28 +0800
committerTeddy <[email protected]>2013-08-09 21:47:28 +0800
commit155c3e5d46909d36d9f595e2a3b8d786240b9520 (patch)
treec3adf4c128dfa3abe00efc40453d38e62f4d5207
parented541c0d83caff9e417a89bc4e6ae83ea22eb214 (diff)
add proper precision to ext repr of real numbers
-rw-r--r--builtin.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin.cpp b/builtin.cpp
index a8091ba..98090e0 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -6,6 +6,7 @@
#include <sstream>
#include <cctype>
#include <cstdlib>
+#include <iomanip>
using std::stringstream;
@@ -34,6 +35,7 @@ static const int NUM_LVL_INT = 3;
string double_to_str(double val, bool force_sign = false) {
stringstream ss;
if (force_sign) ss << std::showpos;
+ ss << std::setprecision(16);
ss << val;
return ss.str();
}