sub(p1, p2)
public
sub(value, digits) -> bigdecimal
Subtract the specified value.
e.g.
c = a.sub(b,n)
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_sub2(VALUE self, VALUE b, VALUE n)
{
ENTER(2);
Real *cv;
SIGNED_VALUE mx = GetPositiveInt(n);
if (mx == 0) return BigDecimal_sub(self, b);
else {
size_t pl = VpSetPrecLimit(0);
VALUE c = BigDecimal_sub(self, b);
VpSetPrecLimit(pl);
GUARD_OBJ(cv, GetVpValue(c, 1));
VpLeftRound(cv, VpGetRoundMode(), mx);
return ToValue(cv);
}
}