Allow any amount to be multipled by another

The result carries the commodity of the first amount, or the second if
the first had no commodity.
This commit is contained in:
John Wiegley 2009-10-27 08:03:16 -04:00
parent 4bdc0a663c
commit a8768587c8

View file

@ -585,13 +585,8 @@ value_t& value_t::operator*=(const value_t& val)
as_amount_lval() *= val.as_long();
return *this;
case AMOUNT:
if (as_amount().commodity() == val.as_amount().commodity() ||
! as_amount().has_commodity() ||
! val.as_amount().has_commodity()) {
as_amount_lval() *= val.as_amount();
return *this;
}
break;
as_amount_lval() *= val.as_amount();
return *this;
default:
break;
}