summaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-10-26 08:31:57 -0700
committerJohn Wiegley <johnw@newartisans.com>2012-10-26 08:31:57 -0700
commit7cee6c559b8198aea9fc75a197bac7bc6e71eaeb (patch)
treefac4c09dba9035c01a25ad84bc4fd3d12fdaa4f7 /src/amount.h
parent34ca6b3991d63dd04d60286452399c7e0d49974b (diff)
parentb044a74bd34afdc27baf6241fe398690ff5e043a (diff)
downloadfork-ledger-7cee6c559b8198aea9fc75a197bac7bc6e71eaeb.tar.gz
fork-ledger-7cee6c559b8198aea9fc75a197bac7bc6e71eaeb.tar.bz2
fork-ledger-7cee6c559b8198aea9fc75a197bac7bc6e71eaeb.zip
Merge pull request #96 from enderw88/Bug634-floor-ceil-round
Bug 634 and 488, Corrected behavior of floor, and added ceiling
Diffstat (limited to 'src/amount.h')
-rw-r--r--src/amount.h9
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 {