@Deprecated public final IRubyObject op_mul19(ThreadContext context, IRubyObject other) { return op_mul(context, other); }
@Deprecated public final IRubyObject op_mul19(ThreadContext context, IRubyObject other) { return op_mul(context, other); }
@Override public IRubyObject op_mul(ThreadContext context, long otherValue) { Ruby runtime = context.runtime; try { return newFixnum(runtime, Math.multiplyExact(value, otherValue)); } catch (ArithmeticException ae) { return RubyBignum.newBignum(runtime, value).op_mul(context, otherValue); } }
@Override public IRubyObject op_mul(ThreadContext context, long otherValue) { Ruby runtime = context.runtime; try { return newFixnum(runtime, Math.multiplyExact(value, otherValue)); } catch (ArithmeticException ae) { return RubyBignum.newBignum(runtime, value).op_mul(context, otherValue); } }
private IRubyObject multiplyOther(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyBignum) { return ((RubyBignum) other).op_mul(context, this); } else if (other instanceof RubyFloat) { return runtime.newFloat((double) value * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, "*", other); }
private IRubyObject multiplyOther(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyBignum) { return ((RubyBignum) other).op_mul(context, this); } else if (other instanceof RubyFloat) { return runtime.newFloat((double) value * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, "*", other); }
private IRubyObject multiplyOther(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyBignum) { return ((RubyBignum) other).op_mul(context, this.value); } if (other instanceof RubyFloat) { return runtime.newFloat((double) value * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, sites(context).op_times, other); }
private IRubyObject multiplyOther(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyBignum) { return ((RubyBignum) other).op_mul(context, this.value); } if (other instanceof RubyFloat) { return runtime.newFloat((double) value * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, sites(context).op_times, other); }
/** f_imul * */ private static RubyInteger f_imul(ThreadContext context, long a, long b) { Ruby runtime = context.runtime; if (a == 0 || b == 0) { return RubyFixnum.zero(runtime); } if (a == 1) { return RubyFixnum.newFixnum(runtime, b); } if (b == 1) { return RubyFixnum.newFixnum(runtime, a); } long c = a * b; if (c / a != b) { return (RubyInteger) RubyBignum.newBignum(runtime, a).op_mul(context, b); } return RubyFixnum.newFixnum(runtime, c); }
/** 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); }
/** f_imul * */ private static RubyInteger f_imul(ThreadContext context, long a, long b) { Ruby runtime = context.runtime; if (a == 0 || b == 0) { return RubyFixnum.zero(runtime); } if (a == 1) { return RubyFixnum.newFixnum(runtime, b); } if (b == 1) { return RubyFixnum.newFixnum(runtime, a); } long c = a * b; if (c / a != b) { return (RubyInteger) RubyBignum.newBignum(runtime, a).op_mul(context, b); } return RubyFixnum.newFixnum(runtime, c); }
/** 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); }
/** f_imul * */ private static IRubyObject f_imul(ThreadContext context, long a, long b) { Ruby runtime = context.runtime; if (a == 0 || b == 0) { return RubyFixnum.zero(runtime); } else if (a == 1) { return RubyFixnum.newFixnum(runtime, b); } else if (b == 1) { return RubyFixnum.newFixnum(runtime, a); } long c = a * b; if(c / a != b) { return RubyBignum.newBignum(runtime, a).op_mul(context, RubyBignum.newBignum(runtime, b)); } return RubyFixnum.newFixnum(runtime, c); }
/** f_imul * */ private static IRubyObject f_imul(ThreadContext context, long a, long b) { Ruby runtime = context.runtime; if (a == 0 || b == 0) { return RubyFixnum.zero(runtime); } else if (a == 1) { return RubyFixnum.newFixnum(runtime, b); } else if (b == 1) { return RubyFixnum.newFixnum(runtime, a); } long c = a * b; if(c / a != b) { return RubyBignum.newBignum(runtime, a).op_mul(context, RubyBignum.newBignum(runtime, b)); } return RubyFixnum.newFixnum(runtime, c); }
return RubyBignum.newBignum(runtime, value).op_mul(context, otherValue);
return RubyBignum.newBignum(runtime, value).op_mul(context, otherValue);
RubyBignum big = RubyBignum.newBignum(runtime, ul); while(occurrences > 0 && pos < encode.limit()) { big = (RubyBignum)big.op_mul(runtime.getCurrentContext(), big128); IRubyObject v = big.op_plus(runtime.getCurrentContext(), RubyBignum.newBignum(runtime, encode.get(pos) & 0x7f));
RubyBignum big = RubyBignum.newBignum(runtime, ul); while(occurrences > 0 && pos < encode.limit()) { IRubyObject mulResult = big.op_mul(runtime.getCurrentContext(), big128); IRubyObject v = mulResult.callMethod(runtime.getCurrentContext(), "+", RubyBignum.newBignum(runtime, encode.get(pos) & 0x7f));