summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/truncateDouble.js
blob: b5c49907681aaffd37a543aa37cf2223b64ca2b9 (plain)
1
2
3
4
5
6
7
8
9
10

// check correctness of truncation of doubles slightly outside the int32_t range.

function truncate(x) {
  return x | 0;
}

assertEq(truncate(0xffffffff), -1);
assertEq(truncate(0xffffffff + 5000.5), 4999);
assertEq(truncate(-0xffffffff - 5000.5), -4999);