test262-automation e9a5a7f918 [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
2018-07-03 15:59:58 -04:00

34 lines
677 B
JavaScript

//@ runBigIntEnabled
let assert = {
sameValue: function(i, e, m) {
if (i !== e)
throw new Error(m);
}
}
function bigIntMod(x, y) {
return x % y;
}
noInline(bigIntMod);
for (let i = 0; i < 10000; i++) {
let r = bigIntMod(30n, 10n);
assert.sameValue(r, 0n, 30n + " % " + 10n + " = " + r);
}
function bigIntModFolding(x, y) {
let r = x % y;
return -r;
}
noInline(bigIntModFolding);
for (let i = 0; i < 10000; i++) {
let r = bigIntModFolding(10, 30);
assert.sameValue(r, -10, "-(" + 10 + " % " + 30 + ") = " + r);
}
let r = bigIntModFolding(10n, 30n);
assert.sameValue(r, -10n, "-(" + 10n + " % " + 30n + ") = " + r);