Skip to content

Commit 54bfc0a

Browse files
ptomatoMs2ger
authored andcommitted
Another small optimization in rounding
Skip calculating isEven if we short-circuit ApplyUnsignedRoundingMode in RoundNumberToIncrementAsIfPositive.
1 parent 407adc9 commit 54bfc0a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

polyfill/lib/ecmascript.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4040,10 +4040,9 @@ export function RoundNumberToIncrementAsIfPositive(quantity, increment, mode) {
40404040
// Similar to the comparison in RoundNumberToIncrement, but multiplied by an
40414041
// extra sign to make sure we treat it as positive
40424042
const cmp = remainder.times(2).abs().compare(increment) * (quantity.lt(0) ? -1 : 1);
4043-
const even = r1.isEven();
40444043
const rounded = remainder.isZero()
40454044
? quotient
4046-
: ApplyUnsignedRoundingMode(r1, r2, cmp, even, unsignedRoundingMode);
4045+
: ApplyUnsignedRoundingMode(r1, r2, cmp, r1.isEven(), unsignedRoundingMode);
40474046
return rounded.times(increment);
40484047
}
40494048

0 commit comments

Comments
 (0)