From 4082acd24f0049604f840fb5e60977e247aafbdf Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 14 Sep 2015 23:30:03 -0700 Subject: 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. --- 032array.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '032array.cc') diff --git a/032array.cc b/032array.cc index 62021466..1b8d5900 100644 --- a/032array.cc +++ b/032array.cc @@ -156,7 +156,7 @@ case INDEX: { vector offset_val(read_memory(offset)); vector element_type = array_element(base.types); if (offset_val.at(0) < 0 || offset_val.at(0) >= Memory[base_address]) { - raise << current_recipe_name() << ": invalid index " << offset_val.at(0) << '\n' << end(); + raise << current_recipe_name() << ": invalid index " << no_scientific(offset_val.at(0)) << '\n' << end(); break; } long long int src = base_address + 1 + offset_val.at(0)*size_of(element_type); @@ -251,7 +251,7 @@ case INDEX_ADDRESS: { vector offset_val(read_memory(offset)); vector element_type = array_element(base.types); if (offset_val.at(0) < 0 || offset_val.at(0) >= Memory[base_address]) { - raise << current_recipe_name() << ": invalid index " << offset_val.at(0) << '\n' << end(); + raise << current_recipe_name() << ": invalid index " << no_scientific(offset_val.at(0)) << '\n' << end(); break; } long long int result = base_address + 1 + offset_val.at(0)*size_of(element_type); -- cgit 1.4.1-2-gfad0