diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-09-14 23:30:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-09-14 23:37:12 -0700 |
commit | 4082acd24f0049604f840fb5e60977e247aafbdf (patch) | |
tree | ee0e15149954af80c20f010c47b2f412961ee199 /036call_reply.cc | |
parent | e28fa5f1508ef7ffeb0b72406558534928c28f9e (diff) | |
download | mu-4082acd24f0049604f840fb5e60977e247aafbdf.tar.gz |
2199 - stop printing numbers in scientific notation
Turns out the default format for printing floating point numbers is neither 'scientific' nor 'fixed' even though those are the only two options offered. Reading the C++ standard I found out that the default (modulo locale changes) is basically the same as the printf "%g" format. And "%g" is basically the shorter of: a) %f with trailing zeros trimmed b) %e So we'll just do %f and trim trailing zeros.
Diffstat (limited to '036call_reply.cc')
-rw-r--r-- | 036call_reply.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/036call_reply.cc b/036call_reply.cc index 8d3f1395..2cb4922e 100644 --- a/036call_reply.cc +++ b/036call_reply.cc @@ -100,13 +100,13 @@ string to_string(const vector<double>& in) { if (in.empty()) return "[]"; ostringstream out; if (SIZE(in) == 1) { - out << in.at(0); + out << no_scientific(in.at(0)); return out.str(); } out << "["; for (long long int i = 0; i < SIZE(in); ++i) { if (i > 0) out << ", "; - out << in.at(i); + out << no_scientific(in.at(i)); } out << "]"; return out.str(); |