summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-31 04:25:05 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-31 04:25:05 -0400
commite9ff5caa13e2d60681010dbedcf56459ee7521a4 (patch)
tree056a124c232daccb3dcc616a32fb3b2a9c217d86 /src/balance.h
parentc96ab6cb0fb289cd50fb239ba44c01aba131fc18 (diff)
downloadfork-ledger-e9ff5caa13e2d60681010dbedcf56459ee7521a4.tar.gz
fork-ledger-e9ff5caa13e2d60681010dbedcf56459ee7521a4.tar.bz2
fork-ledger-e9ff5caa13e2d60681010dbedcf56459ee7521a4.zip
Rationals based math is now passing the unit tests.
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/balance.h b/src/balance.h
index eec86576..d1e4301b 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -311,38 +311,17 @@ public:
return temp;
}
-#ifdef INTEGER_MATH
-
- balance_t round() const {
+ balance_t rounded() const {
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)
- temp += pair.second.round();
+ temp += pair.second.rounded();
return temp;
}
- balance_t& in_place_round() {
- foreach (amounts_map::value_type& pair, amounts)
- pair.second.in_place_round();
- return *this;
- }
-
- balance_t round(amount_t::precision_t prec) const {
- balance_t temp;
- foreach (const amounts_map::value_type& pair, amounts)
- temp += pair.second.round(prec);
- return temp;
- }
- balance_t& in_place_round(amount_t::precision_t prec) {
- foreach (amounts_map::value_type& pair, amounts)
- pair.second.in_place_round(prec);
- return *this;
- }
-
-#endif // INTEGER_MATH
- balance_t unround() const {
+ balance_t unrounded() const {
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)
- temp += pair.second.unround();
+ temp += pair.second.unrounded();
return temp;
}