summaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
commita034435c4287aba7fd32ed63a745e560350c924a (patch)
treef0acb080410a32c215c2c1938811cc14d512b580 /src/amount.h
parent5ffa987daf4d97c52066e4c28733d826d3726297 (diff)
parentf0f1b0cdfa3a0a73695eda52b25de71bd40adc5a (diff)
downloadfork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.gz
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.bz2
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.zip
Merge branch 'next'
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 505e2ea7..c75370e3 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -354,6 +354,15 @@ public:
*this = amount_t(to_string());
}
+ /** Yields an amount which has lost all of its extra precision, beyond what
+ the display precision of the commodity would have printed. */
+ amount_t floored() const {
+ amount_t temp(*this);
+ temp.in_place_floor();
+ return temp;
+ }
+ void in_place_floor();
+
/** Yields an amount whose display precision is never truncated, even
though its commodity normally displays only rounded values. */
amount_t unrounded() const {