ARM JIT: `Math.round` is buggy for integers between 2**52+1 and 2**53-1
Math.round is implemented like Math.floor(x + 0.5) seems, and so is buggy for some values:
Math.round(0.5 - Number.EPSILON / 4) - should give 0, not 1
Math.round(1 / Number.EPSILON + 1) - should give 1 / Number.EPSILON + 1
Math.round(-(1 / Number.EPSILON + 1)) - should give 1 / Number.EPSILON + 1
Actually, there is no need to "round" values which has absolute value >= 1 / Number.EPSILON.
see https://github.com/tc39/test262/blob/26e6fd7c1779a63913cc7720cbc6c87b3b7b3285/test/built-ins/Math/round/S15.8.2.15_A7.js
Neither of the ES5 and ES6 standards says anything special about the value of Math.round(1 / Number.EPSILON + 1). Please see http://www.ecma-international.org/ecma-262/5.1/#sec-15.8.2.15, and http://www.ecma-international.org/ecma-262/6.0/#sec-math.round
@mcfi ,
Returns the Number value that is closest to x and is equal to a mathematical integer- see Note 2
Math.round(x) may also differ from the value of Math.floor(x+0.5)because of internal rounding when computing x+0.5.
@Yaffle , I see what you mean, thank!
@mcfi , thank you, I wan unclear
Note this now only needs to be fixed for ARM JIT.
@sigatrev does this issue exists for arm64?
@agarwal-sandeep I am not seeing this repro on my arm64 machine using either ARM or ARM64 binaries
@sigatrev should we close as no repro?