summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-01-30 18:56:00 -0800
committerCraig Earls <enderw88@gmail.com>2013-01-30 18:56:00 -0800
commitd9b1258c3480f79a0413cf4c5d07c6818c140503 (patch)
treec3416c163e9f13b1fdd2a5ccc3400375723e7aac /src/balance.h
parentb21ee1de170f99e8ed5c82546c8ae69e209bd8d6 (diff)
parent0df13661686dfec66aa0d5a8dd88920e1e104fbc (diff)
downloadledger-d9b1258c3480f79a0413cf4c5d07c6818c140503.tar.gz
ledger-d9b1258c3480f79a0413cf4c5d07c6818c140503.tar.bz2
ledger-d9b1258c3480f79a0413cf4c5d07c6818c140503.zip
Merge pull request #140 from enderw88/Bug634-floor-ceil-round
Bug 634 Added roundto function, optimized floor and ceiling
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();