@Deprecated public IRubyObject op_mod19(ThreadContext context, IRubyObject other) { return op_mod(context, other); }
@Deprecated public IRubyObject op_mod19(ThreadContext context, IRubyObject other) { return op_mod(context, other); }
/** rb_big_modulo * */ @JRubyMethod(name = {"%", "modulo"}, required = 1) public IRubyObject op_mod(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) { return op_mod(context, ((RubyFixnum) other).getLongValue()); } final BigInteger otherValue; if (other instanceof RubyBignum) { otherValue = ((RubyBignum) other).value; if (otherValue.signum() == 0) throw context.runtime.newZeroDivisionError(); BigInteger result = value.mod(otherValue.abs()); if (otherValue.signum() == -1 && result.signum() != 0) result = otherValue.add(result); return bignorm(context.runtime, result); } if (other instanceof RubyFloat && ((RubyFloat) other).getDoubleValue() == 0) { throw context.runtime.newZeroDivisionError(); } return coerceBin(context, sites(context).op_mod, other); }
/** rb_big_modulo * */ @JRubyMethod(name = {"%", "modulo"}, required = 1) public IRubyObject op_mod(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) { return op_mod(context, ((RubyFixnum) other).getLongValue()); } final BigInteger otherValue; if (other instanceof RubyBignum) { otherValue = ((RubyBignum) other).value; if (otherValue.signum() == 0) throw context.runtime.newZeroDivisionError(); BigInteger result = value.mod(otherValue.abs()); if (otherValue.signum() == -1 && result.signum() != 0) result = otherValue.add(result); return bignorm(context.runtime, result); } if (other instanceof RubyFloat && ((RubyFloat) other).getDoubleValue() == 0) { throw context.runtime.newZeroDivisionError(); } return coerceBin(context, sites(context).op_mod, other); }
/** rb_big_modulo * */ @JRubyMethod(name = {"%", "modulo"}, required = 1, compat = RUBY1_9) public IRubyObject op_mod19(ThreadContext context, IRubyObject other) { if (!other.isNil() && other instanceof RubyFloat && ((RubyFloat)other).getDoubleValue() == 0) { throw context.runtime.newZeroDivisionError(); } return op_mod(context, other); }
/** rb_big_modulo * */ @JRubyMethod(name = {"%", "modulo"}, required = 1, compat = RUBY1_9) public IRubyObject op_mod19(ThreadContext context, IRubyObject other) { if (!other.isNil() && other instanceof RubyFloat && ((RubyFloat)other).getDoubleValue() == 0) { throw context.runtime.newZeroDivisionError(); } return op_mod(context, other); }