private IRubyObject addOther(ThreadContext context, IRubyObject other) { return coerceBin(context, "+", other); }
private IRubyObject subtractOther(ThreadContext context, IRubyObject other) { return coerceBin(context, "-", other); }
private IRubyObject subtractOther(ThreadContext context, IRubyObject other) { return coerceBin(context, "-", other); }
private IRubyObject addOther(ThreadContext context, IRubyObject other) { return coerceBin(context, "+", other); }
private IRubyObject subtractOther(ThreadContext context, IRubyObject other) { return coerceBin(context, sites(context).op_minus, other); }
private IRubyObject addOther(ThreadContext context, IRubyObject other) { return coerceBin(context, sites(context).op_plus, other); }
private IRubyObject subtractOther(ThreadContext context, IRubyObject other) { return coerceBin(context, sites(context).op_minus, other); }
private IRubyObject addOther(ThreadContext context, IRubyObject other) { return coerceBin(context, sites(context).op_plus, other); }
public IRubyObject opMulOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, "*", other); }
public IRubyObject opMulOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, "*", other); }
/** rb_big_and * */ @JRubyMethod(name = "&", required = 1, compat = RUBY1_8) public IRubyObject op_and(ThreadContext context, IRubyObject other) { other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.and(((RubyBignum) other).value)); } else if (other instanceof RubyFixnum) { return bignorm(getRuntime(), value.and(fix2big((RubyFixnum)other))); } return coerceBin(context, "&", other); }
/** rb_big_and * */ @JRubyMethod(name = "&", required = 1, compat = RUBY1_8) public IRubyObject op_and(ThreadContext context, IRubyObject other) { other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.and(((RubyBignum) other).value)); } else if (other instanceof RubyFixnum) { return bignorm(getRuntime(), value.and(fix2big((RubyFixnum)other))); } return coerceBin(context, "&", other); }
/** rb_big_quo * */ @JRubyMethod(name = "quo", required = 1, compat = RUBY1_8) @Override public IRubyObject quo(ThreadContext context, IRubyObject other) { if (other instanceof RubyNumeric) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) / ((RubyNumeric) other).getDoubleValue()); } else { return coerceBin(context, "quo", other); } }
/** rb_big_quo * */ @JRubyMethod(name = "quo", required = 1, compat = RUBY1_8) @Override public IRubyObject quo(ThreadContext context, IRubyObject other) { if (other instanceof RubyNumeric) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) / ((RubyNumeric) other).getDoubleValue()); } else { return coerceBin(context, "quo", other); } }
/** rb_big_mul * */ @JRubyMethod(name = "*", required = 1) public IRubyObject op_mul(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) { return op_mul(context, ((RubyFixnum) other).getLongValue()); } if (other instanceof RubyBignum) { return bignorm(context.runtime, value.multiply(((RubyBignum) other).value)); } if (other instanceof RubyFloat) { return RubyFloat.newFloat(context.runtime, big2dbl(this) * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, sites(context).op_times, other); }
/** rb_big_mul * */ @JRubyMethod(name = "*", required = 1) public IRubyObject op_mul(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) { return op_mul(context, ((RubyFixnum) other).getLongValue()); } if (other instanceof RubyBignum) { return bignorm(context.runtime, value.multiply(((RubyBignum) other).value)); } if (other instanceof RubyFloat) { return RubyFloat.newFloat(context.runtime, big2dbl(this) * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, sites(context).op_times, other); }
/** rb_big_xor * */ @JRubyMethod(name = "^", required = 1, compat = RUBY1_8) public IRubyObject op_xor(ThreadContext context, IRubyObject other) { other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.xor(((RubyBignum) other).value)); } if (other instanceof RubyFixnum) { return bignorm(getRuntime(), value.xor(BigInteger.valueOf(((RubyFixnum) other).getLongValue()))); } return coerceBin(context, "^", other); }
/** rb_big_xor * */ @JRubyMethod(name = "^", required = 1, compat = RUBY1_8) public IRubyObject op_xor(ThreadContext context, IRubyObject other) { other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.xor(((RubyBignum) other).value)); } if (other instanceof RubyFixnum) { return bignorm(getRuntime(), value.xor(BigInteger.valueOf(((RubyFixnum) other).getLongValue()))); } return coerceBin(context, "^", other); }
/** rb_big_or * */ @JRubyMethod(name = "|", required = 1, compat = RUBY1_8) public IRubyObject op_or(ThreadContext context, IRubyObject other) { other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.or(((RubyBignum) other).value)); } if (other instanceof RubyFixnum) { // no bignorm here needed return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other))); } return coerceBin(context, "|", other); }
/** rb_big_or * */ @JRubyMethod(name = "|", required = 1, compat = RUBY1_8) public IRubyObject op_or(ThreadContext context, IRubyObject other) { other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.or(((RubyBignum) other).value)); } if (other instanceof RubyFixnum) { // no bignorm here needed return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other))); } return coerceBin(context, "|", other); }