diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-31 04:25:05 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-31 04:25:05 -0400 |
commit | e9ff5caa13e2d60681010dbedcf56459ee7521a4 (patch) | |
tree | 056a124c232daccb3dcc616a32fb3b2a9c217d86 /src/balance.h | |
parent | c96ab6cb0fb289cd50fb239ba44c01aba131fc18 (diff) | |
download | fork-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.h | 29 |
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; } |