pub(crate) fn rem_fixnum(lhsi: i64, rhs: Value) -> VMResult {
    let val = if let Some(i2) = rhs.as_fixnum() {
        if i2.is_zero() {
            return Err(RubyError::zero_div("Divided by zero."));
        }
        Value::integer(lhsi.rem_floor(&i2))
    } else if let Some(f2) = rhs.as_float() {
        if f2.is_zero() {
            return Err(RubyError::zero_div("Divided by zero."));
        }
        Value::float(rem_floorf64(lhsi as f64, f2))
    } else if let Some(b2) = rhs.as_bignum() {
        if b2.is_zero() {
            return Err(RubyError::zero_div("Divided by zero."));
        }
        Value::bignum(BigInt::from(lhsi).mod_floor(&b2))
    } else {
        return Err(VMError::cant_coerse(rhs, "Integer"));
    };
    Ok(val)
}
modulus operation (%)

Ruby use `floored division` for divide/modulus operation.
ruruby/src/arith.rs