summaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/amount.h')
-rw-r--r--src/amount.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/amount.h b/src/amount.h
index b6ca6d16..90f1359c 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -322,6 +322,12 @@ public:
@see set_keep_precision */
amount_t rounded() const;
+ /** Yields an amount which has lost all of its extra precision, beyond what
+ the display precision of the commodity would have printed. */
+ amount_t truncated() const {
+ return amount_t(to_string());
+ }
+
/** Yields an amount whose display precision is never truncated, even
though its commodity normally displays only rounded values. */
amount_t unrounded() const;