diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-11 03:39:53 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-11 03:39:53 -0500 |
commit | afe87280e091d4f094f068c5f21aecccd2d1831b (patch) | |
tree | 4be3e5c9bbcc9b450a6c0eea3f6b959daab22757 /src/amount.h | |
parent | 4a4ff9d4b21e7ed94524314ca496bd17c84fc4ed (diff) | |
download | fork-ledger-afe87280e091d4f094f068c5f21aecccd2d1831b.tar.gz fork-ledger-afe87280e091d4f094f068c5f21aecccd2d1831b.tar.bz2 fork-ledger-afe87280e091d4f094f068c5f21aecccd2d1831b.zip |
Added floored() and in_place_floor() methods
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 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 { |