} else if (other instanceof RubyFloat) { d = ((RubyFloat) other).getDoubleValue(); if (this.compareTo(RubyFixnum.zero(runtime)) == -1 && d != Math.round(d)) { return RubyComplex.newComplexRaw(getRuntime(), this).callMethod(context, "**", other);
} else if (other instanceof RubyFloat) { d = ((RubyFloat) other).getDoubleValue(); if (this.compareTo(RubyFixnum.zero(runtime)) == -1 && d != Math.round(d)) { return RubyComplex.newComplexRaw(getRuntime(), this).callMethod(context, "**", other);
/** rb_big_pow * */ @Override @JRubyMethod(name = {"**", "power"}, required = 1) public IRubyObject op_pow(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other == RubyFixnum.zero(runtime)) return RubyFixnum.one(runtime); final double d; if (other instanceof RubyFloat) { d = ((RubyFloat) other).getDoubleValue(); if (compareTo(RubyFixnum.zero(runtime)) == -1 && d != Math.round(d)) { RubyComplex complex = RubyComplex.newComplexRaw(context.runtime, this); return sites(context).op_exp.call(context, complex, complex, other); } } else if (other instanceof RubyBignum) { d = ((RubyBignum) other).getDoubleValue(); context.runtime.getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big"); } else if (other instanceof RubyFixnum) { return op_pow(context, other.convertToInteger().getLongValue()); } else { return coerceBin(context, sites(context).op_exp, other); } return pow(runtime, d); }
/** rb_big_pow * */ @Override @JRubyMethod(name = {"**", "power"}, required = 1) public IRubyObject op_pow(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other == RubyFixnum.zero(runtime)) return RubyFixnum.one(runtime); final double d; if (other instanceof RubyFloat) { d = ((RubyFloat) other).getDoubleValue(); if (compareTo(RubyFixnum.zero(runtime)) == -1 && d != Math.round(d)) { RubyComplex complex = RubyComplex.newComplexRaw(context.runtime, this); return sites(context).op_exp.call(context, complex, complex, other); } } else if (other instanceof RubyBignum) { d = ((RubyBignum) other).getDoubleValue(); context.runtime.getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big"); } else if (other instanceof RubyFixnum) { return op_pow(context, other.convertToInteger().getLongValue()); } else { return coerceBin(context, sites(context).op_exp, other); } return pow(runtime, d); }