summaryrefslogtreecommitdiff
path: root/src/amount.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/amount.h')
-rw-r--r--src/amount.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/amount.h b/src/amount.h
index 49027bb7..938d4b7b 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2012, John Wiegley. All rights reserved.
+ * Copyright (c) 2003-2013, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -346,6 +346,13 @@ public:
}
void in_place_round();
+ amount_t roundto(int places) const {
+ amount_t temp(*this);
+ temp.in_place_round();
+ return temp;
+ }
+ void in_place_roundto(int places);
+
/** 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 {
@@ -364,6 +371,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 {
@@ -777,7 +793,7 @@ inline std::istream& operator>>(std::istream& in, amount_t& amt) {
}
void put_amount(property_tree::ptree& pt, const amount_t& amt,
- bool wrap = true, bool commodity_details = false);
+ bool commodity_details = false);
} // namespace ledger