Skip to content
Permalink
Browse files
[Truffle] Removed Math.floor and Math.ceil calls since JVM truncation…
… seems to provide the same semantics.
  • Loading branch information
nirvdrum committed Dec 19, 2014
1 parent 2e6a4d0 commit 40ba65578a6d3fb0f96ca1ac99f9ad451c4e7094
Showing with 1 addition and 12 deletions.
  1. +1 −12 core/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
@@ -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();
@@ -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);
}

}

0 comments on commit 40ba655

Please sign in to comment.