From 90404e85fa222bf11a8d338a659c1395d82c4c31 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 31 Jan 2009 15:42:40 -0400 Subject: [PATCH] Corrected the way that thousands markers are output. --- src/amount.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/amount.cc b/src/amount.cc index f0266b36..6f945002 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -580,7 +580,7 @@ namespace { for (const char * p = buf; *p; p++) { if (*p == '.') break; - else if (std::isdigit(*p)) + else if (*p != '-') integer_digits++; } } @@ -591,16 +591,20 @@ namespace { out << ','; else out << *p; - assert(integer_digits < 3); - } else { - if (integer_digits >= 3 && std::isdigit(*p) && - integer_digits-- % 3 == 0) { + assert(integer_digits <= 3); + } + else if (*p == '-') { + out << *p; + } + else { + out << *p; + + if (integer_digits > 3 && --integer_digits % 3 == 0) { if (comm && comm->has_flags(COMMODITY_STYLE_EUROPEAN)) out << '.'; else out << ','; } - out << *p; } } } else {