summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-09-14 19:36:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-09-14 19:36:55 -0400
commit0135c28049839c2db25351b8d8114f9f31649afc (patch)
tree6a7871175a462eacd92468b77fced92714169f0b /src/value.cc
parent3add2229e0dd1f583596a313a76991249a521bae (diff)
downloadfork-ledger-0135c28049839c2db25351b8d8114f9f31649afc.tar.gz
fork-ledger-0135c28049839c2db25351b8d8114f9f31649afc.tar.bz2
fork-ledger-0135c28049839c2db25351b8d8114f9f31649afc.zip
Added in_place_round method to all Ledger numerical types.
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index b079c54b..be78327a 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -1395,6 +1395,26 @@ value_t value_t::round() const
return NULL_VALUE;
}
+void value_t::in_place_round()
+{
+ switch (type()) {
+ case INTEGER:
+ break;
+ case AMOUNT:
+ as_amount_lval().in_place_round();
+ break;
+ case BALANCE:
+ as_balance_lval().in_place_round();
+ break;
+ case BALANCE_PAIR:
+ as_balance_pair_lval().in_place_round();
+ break;
+ default:
+ throw_(value_error, "Cannot round " << label());
+ break;
+ }
+}
+
value_t value_t::unround() const
{
switch (type()) {