summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-03-04 15:27:38 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 05:48:44 -0400
commit687eaefc375c06b122f83e4235745837add195d5 (patch)
tree05d296b0b6f0655bb5dc1471cc244681f0e46f80
parent65682175e14855a3fe16e1c2636b8cb2dffa7610 (diff)
downloadfork-ledger-687eaefc375c06b122f83e4235745837add195d5.tar.gz
fork-ledger-687eaefc375c06b122f83e4235745837add195d5.tar.bz2
fork-ledger-687eaefc375c06b122f83e4235745837add195d5.zip
*** no comment ***
-rw-r--r--amount.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/amount.cc b/amount.cc
index 1fe2ecdd..b2588fc2 100644
--- a/amount.cc
+++ b/amount.cc
@@ -812,10 +812,14 @@ std::ostream& operator<<(std::ostream& _out, const amount_t& amt)
if (precision) {
out << ((comm.flags & COMMODITY_STYLE_EUROPEAN) ? ',' : '.');
+ char * p = mpz_get_str(NULL, 10, rquotient);
+ int len = std::strlen(p);
+ if (len < precision)
+ precision = len < comm.precision() ? comm.precision() : len;
+
out.width(precision);
out.fill('0');
- char * p = mpz_get_str(NULL, 10, rquotient);
out << p;
std::free(p);
}