summaryrefslogtreecommitdiff
path: root/balance.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-03-05 01:32:50 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 05:48:44 -0400
commit6ac8f7b603a6135ff9eb7923e5e6027dbd89af56 (patch)
tree1ccd126d9d74922b5b42a1b8fbea0a2dbe2af5f9 /balance.cc
parent7b591dd27a53f60aed7d2f6fe81d2953aa49b1b2 (diff)
downloadledger-6ac8f7b603a6135ff9eb7923e5e6027dbd89af56.tar.gz
ledger-6ac8f7b603a6135ff9eb7923e5e6027dbd89af56.tar.bz2
ledger-6ac8f7b603a6135ff9eb7923e5e6027dbd89af56.zip
*** no comment ***
Diffstat (limited to 'balance.cc')
-rw-r--r--balance.cc15
1 files changed, 2 insertions, 13 deletions
diff --git a/balance.cc b/balance.cc
index 8ca49ea0..7337dda8 100644
--- a/balance.cc
+++ b/balance.cc
@@ -87,10 +87,7 @@ void balance_t::write(std::ostream& out,
balance_t& balance_t::operator*=(const balance_t& bal)
{
- if (! *this || ! bal) {
- return (*this = 0L);
- }
- else if (amounts.size() == 1 && bal.amounts.size() == 1) {
+ if (amounts.size() == 1 && bal.amounts.size() == 1) {
return *this *= (*bal.amounts.begin()).second;
}
else {
@@ -103,15 +100,7 @@ balance_t& balance_t::operator*=(const balance_t& bal)
balance_t& balance_t::operator/=(const balance_t& bal)
{
- if (! *this) {
- return (*this = 0L);
- }
- else if (! bal) {
- std::ostringstream errmsg;
- errmsg << "Attempt to divide by zero: " << *this << " / " << bal;
- throw amount_error(errmsg.str());
- }
- else if (amounts.size() == 1 && bal.amounts.size() == 1) {
+ if (amounts.size() == 1 && bal.amounts.size() == 1) {
return *this /= (*bal.amounts.begin()).second;
}
else if (*this == bal) {