Method: BigDecimal#modulo

Defined in:
bigdecimal.c

#moduloObject

%: a%b = a - (a.to_f/b).floor * b



2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
# File 'bigdecimal.c', line 2052

static VALUE
BigDecimal_mod(VALUE self, VALUE r) /* %: a%b = a - (a.to_f/b).floor * b */
{
    ENTER(3);
    Real *div = NULL, *mod = NULL;

    if (BigDecimal_DoDivmod(self, r, &div, &mod)) {
	SAVE(div); SAVE(mod);
        return VpCheckGetValue(mod);
    }
    return DoSomeOne(self, r, '%');
}