From 0135c28049839c2db25351b8d8114f9f31649afc Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 14 Sep 2008 19:36:55 -0400 Subject: Added in_place_round method to all Ledger numerical types. --- src/amount.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/amount.h') diff --git a/src/amount.h b/src/amount.h index 0c849017..006c554a 100644 --- a/src/amount.h +++ b/src/amount.h @@ -377,8 +377,20 @@ public: return *this; } - amount_t round() const; - amount_t round(precision_t prec) const; + amount_t round() const { + amount_t temp(*this); + temp.in_place_round(); + return temp; + } + amount_t& in_place_round(); + + amount_t round(precision_t prec) const { + amount_t temp(*this); + temp.in_place_round(prec); + return temp; + } + amount_t& in_place_round(precision_t prec); + amount_t unround() const; amount_t reduce() const { -- cgit v1.2.3