Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5ec42398ad69
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c91c0cd21d42
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 3, 2014

  1. Typecheck arg for op_mod19

    Check for fixnum/float/bignum before casting `other`, and coerce if not a known good type.
    Fixes cases like (1.23 ** nil) throwing a Java exception rather than a TypeError.
    cheald committed Nov 3, 2014
    Copy the full SHA
    e902978 View commit details

Commits on Nov 4, 2014

  1. Merge pull request #2087 from cheald/fix_opmod19

    Typecheck arg for op_mod19
    headius committed Nov 4, 2014
    Copy the full SHA
    c91c0cd View commit details
Showing with 12 additions and 5 deletions.
  1. +12 −5 core/src/main/java/org/jruby/RubyFloat.java
17 changes: 12 additions & 5 deletions core/src/main/java/org/jruby/RubyFloat.java
Original file line number Diff line number Diff line change
@@ -453,11 +453,18 @@ public IRubyObject op_pow(ThreadContext context, double other) {

@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);
switch (other.getMetaClass().getClassIndex()) {
case FIXNUM:
case BIGNUM:
case FLOAT:
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);
}
default:
return coerceBin(context, "**", other);
}
}