summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-26 00:10:08 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-26 00:10:08 -0400
commit74e569e220bee08d6c9eda59b5e4021748344994 (patch)
tree6976db78d273adb515db5ff9be68c29c321d7811 /src/balance.h
parent247cf58bfa348ba104afe9328945979c4b154e46 (diff)
downloadfork-ledger-74e569e220bee08d6c9eda59b5e4021748344994.tar.gz
fork-ledger-74e569e220bee08d6c9eda59b5e4021748344994.tar.bz2
fork-ledger-74e569e220bee08d6c9eda59b5e4021748344994.zip
Added a truncated() method for amounts and values
When an amount is truncated, it drops all of the extra precision and becomes exactly the value would have seen were it printed.
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/balance.h b/src/balance.h
index a9684796..f8e4f25c 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -318,6 +318,13 @@ public:
return temp;
}
+ balance_t truncated() const {
+ balance_t temp;
+ foreach (const amounts_map::value_type& pair, amounts)
+ temp += pair.second.truncated();
+ return temp;
+ }
+
balance_t unrounded() const {
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)