modulo(p1)
public
Returns the modulo after division of
float by other.
6543.21.modulo(137)
6543.21.modulo(137.24)
Show source
static VALUE
flo_mod(VALUE x, VALUE y)
{
double fy;
if (RB_TYPE_P(y, T_FIXNUM)) {
fy = (double)FIX2LONG(y);
}
else if (RB_TYPE_P(y, T_BIGNUM)) {
fy = rb_big2dbl(y);
}
else if (RB_TYPE_P(y, T_FLOAT)) {
fy = RFLOAT_VALUE(y);
}
else {
return rb_num_coerce_bin(x, y, '%');
}
return DBL2NUM(ruby_float_mod(RFLOAT_VALUE(x), fy));
}