private IRubyObject compareOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return newFixnum(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).value)); } if (other instanceof RubyFloat) { return dbl_cmp(context.runtime, (double) value, ((RubyFloat) other).getDoubleValue()); } return coerceCmp(context, sites(context).op_cmp, other); }
private IRubyObject compareOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return newFixnum(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).value)); } if (other instanceof RubyFloat) { return dbl_cmp(context.runtime, (double) value, ((RubyFloat) other).getDoubleValue()); } return coerceCmp(context, sites(context).op_cmp, other); }
private IRubyObject compareOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return newFixnum(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum)other).getValue())); } if (other instanceof RubyFloat) { return dbl_cmp(context.runtime, (double)value, ((RubyFloat)other).getDoubleValue()); } return coerceCmp(context, "<=>", other); }
private IRubyObject compareOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return newFixnum(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum)other).getValue())); } if (other instanceof RubyFloat) { return dbl_cmp(context.runtime, (double)value, ((RubyFloat)other).getDoubleValue()); } return coerceCmp(context, "<=>", other); }
private int compareToOther(IRubyObject other) { if (other instanceof RubyBignum) return BigInteger.valueOf(value).compareTo(((RubyBignum)other).getValue()); if (other instanceof RubyFloat) return Double.compare((double)value, ((RubyFloat)other).getDoubleValue()); return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue(); }
/** fix_cmp * */ @JRubyMethod(name = "<=>") public IRubyObject op_cmp(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) return op_cmp(context, ((RubyFixnum)other).value); return context.is19 ? compareOther(context, other) : coerceCmp(context, "<=>", other); }
private int compareToOther(IRubyObject other) { if (other instanceof RubyBignum) return BigInteger.valueOf(value).compareTo(((RubyBignum) other).value); if (other instanceof RubyFloat) return Double.compare((double)value, ((RubyFloat)other).getDoubleValue()); ThreadContext context = getRuntime().getCurrentContext(); return (int) coerceCmp(context, sites(context).op_cmp, other).convertToInteger().getLongValue(); }
private int compareToOther(IRubyObject other) { if (other instanceof RubyBignum) return BigInteger.valueOf(value).compareTo(((RubyBignum) other).value); if (other instanceof RubyFloat) return Double.compare((double)value, ((RubyFloat)other).getDoubleValue()); ThreadContext context = getRuntime().getCurrentContext(); return (int) coerceCmp(context, sites(context).op_cmp, other).convertToInteger().getLongValue(); }
private int compareToOther(IRubyObject other) { if (other instanceof RubyBignum) return BigInteger.valueOf(value).compareTo(((RubyBignum)other).getValue()); if (other instanceof RubyFloat) return Double.compare((double)value, ((RubyFloat)other).getDoubleValue()); return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue(); }
/** fix_cmp * */ @JRubyMethod(name = "<=>") public IRubyObject op_cmp(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) return op_cmp(context, ((RubyFixnum)other).value); return context.is19 ? compareOther(context, other) : coerceCmp(context, "<=>", other); }
IRubyObject comparison = zero.coerceCmp(context, sites.op_cmp, step);
IRubyObject comparison = zero.coerceCmp(context, sites.op_cmp, step);