diff options
author | John Wiegley <johnw@newartisans.com> | 2003-09-30 07:17:02 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2003-09-30 07:17:02 +0000 |
commit | 85c92e10db043170adbe9a36152907dbb0ea8138 (patch) | |
tree | eafde5c72272c055378a43b843428fdca7643bda /amount.cc | |
parent | 5bd2401bc7cde0e01cd5b9d18cf077e255c4bd45 (diff) | |
download | fork-ledger-85c92e10db043170adbe9a36152907dbb0ea8138.tar.gz fork-ledger-85c92e10db043170adbe9a36152907dbb0ea8138.tar.bz2 fork-ledger-85c92e10db043170adbe9a36152907dbb0ea8138.zip |
*** empty log message ***
Diffstat (limited to 'amount.cc')
-rw-r--r-- | amount.cc | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -268,7 +268,11 @@ static std::string amount_to_str(const commodity * comm, const mpz_t val, if (negative) s << "-"; - if (comm->thousands) { + if (mpz_sgn(quotient) == 0) + s << '0'; + else if (! comm->thousands) + s << quotient; + else { // jww (2003-09-29): use a smarter starting value bool printed = false; @@ -298,8 +302,6 @@ static std::string amount_to_str(const commodity * comm, const mpz_t val, printed = true; } } - } else { - s << quotient; } if (comm->european) @@ -320,7 +322,8 @@ static std::string amount_to_str(const commodity * comm, const mpz_t val, width = MAX_PRECISION - width; - while (p >= buf && *p == '0') + while (p >= buf && *p == '0' && + (p - buf) >= (comm->precision - width)) p--; *(p + 1) = '\0'; |