Skip to content

Commit 40ba655

Browse files
committed
[Truffle] Removed Math.floor and Math.ceil calls since JVM truncation seems to provide the same semantics.
1 parent 2e6a4d0 commit 40ba655

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

core/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,6 @@ public abstract static class ToINode extends CoreMethodNode {
613613

614614
@Child protected FixnumOrBignumNode fixnumOrBignum;
615615

616-
private final BranchProfile greaterZero = new BranchProfile();
617-
private final BranchProfile lessZero = new BranchProfile();
618-
619616
public ToINode(RubyContext context, SourceSection sourceSection) {
620617
super(context, sourceSection);
621618
fixnumOrBignum = new FixnumOrBignumNode();
@@ -636,15 +633,7 @@ public Object toI(double value) {
636633
throw new RaiseException(getContext().getCoreLibrary().floatDomainError("NaN", this));
637634
}
638635

639-
double truncated = value;
640-
641-
if (value > 0.0) {
642-
truncated = Math.floor(value);
643-
} else if (value < 0.0) {
644-
truncated = Math.ceil(value);
645-
}
646-
647-
return fixnumOrBignum.fixnumOrBignum(getContext(), truncated);
636+
return fixnumOrBignum.fixnumOrBignum(getContext(), value);
648637
}
649638

650639
}

0 commit comments

Comments
 (0)