summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-01-30 15:35:31 -0700
committerCraig Earls <enderw88@gmail.com>2013-01-30 15:35:31 -0700
commit0df13661686dfec66aa0d5a8dd88920e1e104fbc (patch)
treecbf9270fc8fe85d0ae67c1c1f3ab8d42296c232b /src/balance.h
parent383c341d885e1a69fc63aca2ae7db4a2ff5ff1a8 (diff)
downloadfork-ledger-0df13661686dfec66aa0d5a8dd88920e1e104fbc.tar.gz
fork-ledger-0df13661686dfec66aa0d5a8dd88920e1e104fbc.tar.bz2
fork-ledger-0df13661686dfec66aa0d5a8dd88920e1e104fbc.zip
Bug 634 Added roundto function, optimized floor and ceiling
Fixes Bug634 by adding roundto(amount, places).
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/balance.h b/src/balance.h
index 9635742d..f822e353 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -325,6 +325,17 @@ public:
pair.second.in_place_round();
}
+ balance_t roundto(int places) const {
+ balance_t temp(*this);
+ temp.in_place_roundto(places);
+ return temp;
+ }
+
+ void in_place_roundto(int places) {
+ foreach (amounts_map::value_type& pair, amounts)
+ pair.second.in_place_roundto(places);
+ }
+
balance_t truncated() const {
balance_t temp(*this);
temp.in_place_truncate();