private IRubyObject op_equalOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(this.value).compareTo(((RubyBignum) other).value) == 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value == ((RubyFloat) other).getDoubleValue()); } return super.op_num_equal(context, other); }
private IRubyObject op_equalOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(this.value).compareTo(((RubyBignum) other).value) == 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value == ((RubyFloat) other).getDoubleValue()); } return super.op_num_equal(context, other); }
private IRubyObject op_equalOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).getValue()) == 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value == ((RubyFloat) other).getDoubleValue()); } return super.op_num_equal(context, other); }
private IRubyObject op_equalOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).getValue()) == 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value == ((RubyFloat) other).getDoubleValue()); } return super.op_num_equal(context, other); }
/** fix_equal * */ @JRubyMethod(name = "==") @Override public IRubyObject op_equal(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) return op_equal(context, ((RubyFixnum) other).value); return context.is19 ? op_equalOther(context, other) : super.op_num_equal(context, other); }
/** fix_equal * */ @JRubyMethod(name = "==") @Override public IRubyObject op_equal(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) return op_equal(context, ((RubyFixnum) other).value); return context.is19 ? op_equalOther(context, other) : super.op_num_equal(context, other); }