about summary refs log tree commit diff stats
path: root/081run_interactive.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-09-14 23:30:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-09-14 23:37:12 -0700
commit4082acd24f0049604f840fb5e60977e247aafbdf (patch)
treeee0e15149954af80c20f010c47b2f412961ee199 /081run_interactive.cc
parente28fa5f1508ef7ffeb0b72406558534928c28f9e (diff)
downloadmu-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 '081run_interactive.cc')
-rw-r--r--081run_interactive.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc
index ec7f9206..ca314565 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -259,7 +259,7 @@ void track_most_recent_products(const instruction& instruction, const vector<vec
           cerr << read_mu_string(trace_contents("warn")) << '\n';
           cerr << SIZE(products.at(i)) << ": ";
           for (long long int j = 0; j < SIZE(products.at(i)); ++j)
-            cerr << products.at(i).at(j) << ' ';
+            cerr << no_scientific(products.at(i).at(j)) << ' ';
           cerr << '\n';
         }
         assert(scalar(products.at(i)));
@@ -269,7 +269,7 @@ void track_most_recent_products(const instruction& instruction, const vector<vec
       // End Record Product Special-cases
     }
     for (long long int j = 0; j < SIZE(products.at(i)); ++j)
-      out << products.at(i).at(j) << ' ';
+      out << no_scientific(products.at(i).at(j)) << ' ';
     out << '\n';
   }
   Most_recent_products = out.str();
@@ -293,7 +293,7 @@ string strip_comments(string in) {
 long long int stringified_value_of_location(long long int address) {
   // convert to string
   ostringstream out;
-  out << Memory[address];
+  out << no_scientific(Memory[address]);
   return new_mu_string(out.str());
 }