示例#1
0
 @JRubyMethod(name = "**", required = 1)
 public IRubyObject op_pow19(ThreadContext context, IRubyObject other) {
   double d_other = ((RubyNumeric) other).getDoubleValue();
   if (value < 0 && (d_other != Math.round(d_other))) {
     return RubyComplex.newComplexRaw(getRuntime(), this).callMethod(context, "**", other);
   } else {
     return op_pow(context, other);
   }
 }
示例#2
0
 /** num_imaginary */
 @JRubyMethod(name = "i")
 public IRubyObject num_imaginary(ThreadContext context) {
   return RubyComplex.newComplexRaw(context.runtime, RubyFixnum.zero(context.runtime), this);
 }
示例#3
0
 /** numeric_to_c */
 @JRubyMethod(name = "to_c")
 public IRubyObject to_c(ThreadContext context) {
   return RubyComplex.newComplexCanonicalize(context, this);
 }