Skip to content

Commit

Permalink
[Truffle] Removed Math.floor and Math.ceil calls since JVM truncation…
Browse files Browse the repository at this point in the history
… seems to provide the same semantics.
  • Loading branch information
nirvdrum committed Dec 19, 2014
1 parent 2e6a4d0 commit 40ba655
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions core/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
Expand Up @@ -613,9 +613,6 @@ public abstract static class ToINode extends CoreMethodNode {

@Child protected FixnumOrBignumNode fixnumOrBignum;

private final BranchProfile greaterZero = new BranchProfile();
private final BranchProfile lessZero = new BranchProfile();

public ToINode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
fixnumOrBignum = new FixnumOrBignumNode();
Expand All @@ -636,15 +633,7 @@ public Object toI(double value) {
throw new RaiseException(getContext().getCoreLibrary().floatDomainError("NaN", this));
}

double truncated = value;

if (value > 0.0) {
truncated = Math.floor(value);
} else if (value < 0.0) {
truncated = Math.ceil(value);
}

return fixnumOrBignum.fixnumOrBignum(getContext(), truncated);
return fixnumOrBignum.fixnumOrBignum(getContext(), value);
}

}
Expand Down

0 comments on commit 40ba655

Please sign in to comment.