modulo(p1)
public
Return the modulo after division of
flt by other.
6543.21.modulo(137)
6543.21.modulo(137.24)
Show source
/*
* call-seq:
* flt % other => float
* flt.modulo(other) => float
*
* Return the modulo after division of <code>flt</code> by <code>other</code>.
*
* 6543.21.modulo(137) #=> 104.21
* 6543.21.modulo(137.24) #=> 92.9299999999996
*/
static VALUE
flo_mod(x, y)
VALUE x, 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(y)->value;
break;
default:
return rb_num_coerce_bin(x, y);
}
flodivmod(RFLOAT(x)->value, fy, 0, &mod);
return rb_float_new(mod);
}