/*
 *  call-seq:
 *    fix % other         => Numeric
 *    fix.modulo(other)   => Numeric
 *
 *  Returns <code>fix</code> modulo <code>other</code>.
 *  See <code>Numeric.divmod</code> for more information.
 */

static VALUE
fix_mod(VALUE x, VALUE y)
{
    if (FIXNUM_P(y)) {
        long mod;

        fixdivmod(FIX2LONG(x), FIX2LONG(y), 0, &mod);
        return LONG2NUM(mod);
    }
    switch (TYPE(y)) {
      case T_BIGNUM:
        x = rb_int2big(FIX2LONG(x));
        return rb_big_modulo(x, y);
      case T_FLOAT:
        {
            double mod;

            flodivmod((double)FIX2LONG(x), RFLOAT_VALUE(y), 0, &mod);
            return DOUBLE2NUM(mod);
        }
      default:
        return rb_num_coerce_bin(x, y, '%');
    }
}