From b044a74bd34afdc27baf6241fe398690ff5e043a Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Thu, 25 Oct 2012 22:28:26 -0700 Subject: Bug 634 and 488, Corrected behavior of floor, and added ceiling This is only a partial fix for 634, since rounding is not fixed. --- src/amount.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/amount.h') 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 { -- cgit v1.2.3