%(p1)
public
Return the modulo after division of flt by
other.
6543.21.modulo(137)
6543.21.modulo(137.24)
Show source
static VALUE
flo_mod(VALUE x, VALUE y)
{
double fy, mod;
switch (TYPE(y)) {
case T_FIXNUM:
fy = (double)FIX2LONG(y);
break;
case T_BIGNUM:
fy = rb_big2dbl(y);
break;
case T_FLOAT:
fy = RFLOAT_VALUE(y);
break;
default:
return rb_num_coerce_bin(x, y, '%');
}
flodivmod(RFLOAT_VALUE(x), fy, 0, &mod);
return DBL2NUM(mod);
}