diff options
author | Craig Earls <enderw88@gmail.com> | 2013-01-30 15:51:23 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-01-30 15:51:23 -0700 |
commit | aeac4fe252954c21be0b6d2bac67ee74be77bf86 (patch) | |
tree | b362915d8bf22d8192cd052d4efdaeb76e235649 /src/value.cc | |
parent | b334be6d382d3bef45fb4ad46e0f52fd6cb9e0a4 (diff) | |
parent | 0df13661686dfec66aa0d5a8dd88920e1e104fbc (diff) | |
download | ledger-aeac4fe252954c21be0b6d2bac67ee74be77bf86.tar.gz ledger-aeac4fe252954c21be0b6d2bac67ee74be77bf86.tar.bz2 ledger-aeac4fe252954c21be0b6d2bac67ee74be77bf86.zip |
Merge branch 'Bug634-floor-ceil-round' into kitchen-sink
Diffstat (limited to 'src/value.cc')
-rw-r--r-- | src/value.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc index c57cff78..3df8f3c7 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1612,6 +1612,27 @@ void value_t::in_place_round() throw_(value_error, _f("Cannot set rounding for %1%") % label()); } +void value_t::in_place_roundto(int places) +{ + DEBUG("amount.roundto", "=====> roundto places " << places); + switch (type()) { + case INTEGER: + return; + case AMOUNT: + as_amount_lval().in_place_roundto(places); + return; + case BALANCE: + as_balance_lval().in_place_roundto(places); + return; + case SEQUENCE: + foreach (value_t& value, as_sequence_lval()) + value.in_place_roundto(places); + return; + default: + break; + } +} + void value_t::in_place_truncate() { switch (type()) { |