summaryrefslogtreecommitdiff
path: root/entry.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-28 02:16:58 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-29 21:47:54 -0400
commit5aef1add426ca00daee5af38b27c52d7e49e3491 (patch)
tree2dff1f3405a7be97b40f23fa33e3a2c74fdc6357 /entry.cc
parent1bb29cdbb7fa63d2fd5312e3fc81bcc489aaab5d (diff)
downloadledger-5aef1add426ca00daee5af38b27c52d7e49e3491.tar.gz
ledger-5aef1add426ca00daee5af38b27c52d7e49e3491.tar.bz2
ledger-5aef1add426ca00daee5af38b27c52d7e49e3491.zip
Merged over fix to #205 from v2.6.1b, which deals with small commodity
rounding.
Diffstat (limited to 'entry.cc')
-rw-r--r--entry.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/entry.cc b/entry.cc
index 2feaa761..81dfc7df 100644
--- a/entry.cc
+++ b/entry.cc
@@ -311,14 +311,16 @@ bool entry_base_t::finalize()
// (item-position-end-line (entry-position entry))
// (format-value balance :width 20)))
- if (! balance.is_null() && ! balance.is_zero()) {
- error * err =
- new balance_error("Entry does not balance",
- new entry_context(*this, "While balancing entry:"));
+ if (! balance.is_null()) {
balance.round();
- err->context.push_front
- (new value_context(balance, "Unbalanced remainder is:"));
- throw err;
+ if (! balance.is_zero()) {
+ error * err =
+ new balance_error("Entry does not balance",
+ new entry_context(*this, "While balancing entry:"));
+ err->context.push_front
+ (new value_context(balance, "Unbalanced remainder is:"));
+ throw err;
+ }
}
return true;