APIdock / Ruby
/
method

mult

ruby latest stable - Class: BigDecimal
mult(p1, p2)
public

Multiply by the specified value.

e.g.

c = a.mult (b,n)
c = a * b

digits

If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.

static VALUE
BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
{
 ENTER(2);
 Real *cv;
 SIGNED_VALUE mx = GetPrecisionInt(n);
 if (mx == 0) return BigDecimal_mult(self, b);
 else {
 size_t pl = VpSetPrecLimit(0);
 VALUE c = BigDecimal_mult(self, b);
 VpSetPrecLimit(pl);
 GUARD_OBJ(cv, GetVpValue(c, 1));
 VpLeftRound(cv, VpGetRoundMode(), mx);
 return ToValue(cv);
 }
}

AltStyle によって変換されたページ (->オリジナル) /