@Override public double getDoubleValue() { return big2dbl(this); }
@Override public double getDoubleValue() { return big2dbl(this); }
@Override public double getDoubleValue() { return big2dbl(this); }
@Override public double getDoubleValue() { return big2dbl(this); }
private RubyNumeric pow(final Ruby runtime, final double d) { double pow = Math.pow(big2dbl(this), d); if (Double.isInfinite(pow)) { return RubyFloat.newFloat(runtime, pow); } return RubyNumeric.dbl2ival(runtime, pow); }
private RubyNumeric pow(final Ruby runtime, final double d) { double pow = Math.pow(big2dbl(this), d); if (Double.isInfinite(pow)) { return RubyFloat.newFloat(runtime, pow); } return RubyNumeric.dbl2ival(runtime, pow); }
final RubyFloat fdivDouble(ThreadContext context, RubyBignum y) { double dx = getDoubleValue(); double dy = RubyBignum.big2dbl(y); if (Double.isInfinite(dx) || Double.isInfinite(dy)) { return (RubyFloat) fdivInt(context, y); } return context.runtime.newFloat(dx / dy); }
final RubyFloat fdivDouble(ThreadContext context, RubyBignum y) { double dx = getDoubleValue(); double dy = RubyBignum.big2dbl(y); if (Double.isInfinite(dx) || Double.isInfinite(dy)) { return (RubyFloat) fdivInt(context, y); } return context.runtime.newFloat(dx / dy); }
static RubyFloat new_float(final Ruby runtime, RubyInteger num) { if (num instanceof RubyBignum) { return RubyFloat.newFloat(runtime, RubyBignum.big2dbl((RubyBignum) num)); } return RubyFloat.newFloat(runtime, ((RubyFixnum) num).getDoubleValue()); }
static RubyFloat new_float(final Ruby runtime, RubyInteger num) { if (num instanceof RubyBignum) { return RubyFloat.newFloat(runtime, RubyBignum.big2dbl((RubyBignum) num)); } return RubyFloat.newFloat(runtime, ((RubyFixnum) num).getDoubleValue()); }
public IRubyObject op_pow(ThreadContext context, long other) { // MRI issuses warning here on (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) if (((value.bitLength() + 7) / 8) * 4 * Math.abs(other) > 1024 * 1024) { getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big"); } if (other >= 0) { return bignorm(getRuntime(), value.pow((int) other)); // num2int is also implemented } else { return RubyFloat.newFloat(getRuntime(), Math.pow(big2dbl(this), (double)other)); } }
public IRubyObject op_pow(ThreadContext context, long other) { // MRI issuses warning here on (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) if (((value.bitLength() + 7) / 8) * 4 * Math.abs(other) > 1024 * 1024) { getRuntime().getWarnings().warn(ID.MAY_BE_TOO_BIG, "in a**b, b may be too big"); } if (other >= 0) { return bignorm(getRuntime(), value.pow((int) other)); // num2int is also implemented } else { return RubyFloat.newFloat(getRuntime(), Math.pow(big2dbl(this), (double)other)); } }
private IRubyObject subtractFloat(RubyFloat other) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) - other.getDoubleValue()); }
private IRubyObject subtractFloat(RubyFloat other) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) - other.getDoubleValue()); }
private IRubyObject addFloat(RubyFloat other) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) + other.getDoubleValue()); }
private IRubyObject subtractFloat(RubyFloat other) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) - other.getDoubleValue()); }
public IRubyObject opMulOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, "*", other); }
public IRubyObject opMulOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) * ((RubyFloat) other).getDoubleValue()); } return coerceBin(context, "*", other); }
/** rb_big_quo * */ @JRubyMethod(name = "quo", required = 1, compat = RUBY1_8) @Override public IRubyObject quo(ThreadContext context, IRubyObject other) { if (other instanceof RubyNumeric) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) / ((RubyNumeric) other).getDoubleValue()); } else { return coerceBin(context, "quo", other); } }
/** rb_big_quo * */ @JRubyMethod(name = "quo", required = 1, compat = RUBY1_8) @Override public IRubyObject quo(ThreadContext context, IRubyObject other) { if (other instanceof RubyNumeric) { return RubyFloat.newFloat(getRuntime(), big2dbl(this) / ((RubyNumeric) other).getDoubleValue()); } else { return coerceBin(context, "quo", other); } }