diff options
author | John Wiegley <johnw@newartisans.com> | 2008-09-14 19:36:55 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-09-14 19:36:55 -0400 |
commit | 0135c28049839c2db25351b8d8114f9f31649afc (patch) | |
tree | 6a7871175a462eacd92468b77fced92714169f0b /src/amount.h | |
parent | 3add2229e0dd1f583596a313a76991249a521bae (diff) | |
download | fork-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/amount.h')
-rw-r--r-- | src/amount.h | 16 |
1 files changed, 14 insertions, 2 deletions
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 { |