Simplify multiplication.

This commit is contained in:
JoelKatz
2012-12-11 00:15:06 -08:00
parent d705bde28a
commit f2ff4b3773

View File

@@ -758,15 +758,9 @@ Amount.prototype.multiply = function (v) {
result._value = this._value.multiply(v._value);
}
else {
var v1 = this._value.multiply(consts.bi_10).add(3);
var o1 = this._offset - 1;
var v2 = v._value.multiply(consts.bi_10).add(3);
var o2 = v._offset - 1;
// XXX Do we really need to do the offer +14 and divide? Can't canonicalize adjust.
result = new Amount();
result._offset = o1+o2+14;
result._value = v1.multiply(v2).divide(consts.bi_1e14);
result._offset = o1 + o2;
result._value = v1.multiply(v2);
result._is_negative = this._is_negative !== v._is_negative;
result._currency = this._currency.clone();
result._issuer = this._issuer.clone();