%(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;
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, '%');
}
return DBL2NUM(ruby_float_mod(RFLOAT_VALUE(x), fy));
}