diff options
author | Craig Earls <enderw88@gmail.com> | 2012-10-25 22:28:26 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2012-10-25 22:28:26 -0700 |
commit | b044a74bd34afdc27baf6241fe398690ff5e043a (patch) | |
tree | 6cf2168e51611a86e04d834b2a507322a8a8fe04 /src/amount.h | |
parent | 4b261f99bc56853b3468a8a1bb5b4af39ed67af5 (diff) | |
download | fork-ledger-b044a74bd34afdc27baf6241fe398690ff5e043a.tar.gz fork-ledger-b044a74bd34afdc27baf6241fe398690ff5e043a.tar.bz2 fork-ledger-b044a74bd34afdc27baf6241fe398690ff5e043a.zip |
Bug 634 and 488, Corrected behavior of floor, and added ceiling
This is only a partial fix for 634, since rounding is not fixed.
Diffstat (limited to 'src/amount.h')
-rw-r--r-- | src/amount.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/amount.h b/src/amount.h index 49027bb7..1b7d2101 100644 --- a/src/amount.h +++ b/src/amount.h @@ -364,6 +364,15 @@ public: } void in_place_floor(); + /** Yields an amount which has lost all of its extra precision, beyond what + the display precision of the commodity would have printed. */ + amount_t ceilinged() const { + amount_t temp(*this); + temp.in_place_ceiling(); + return temp; + } + void in_place_ceiling(); + /** Yields an amount whose display precision is never truncated, even though its commodity normally displays only rounded values. */ amount_t unrounded() const { |