diff options
Diffstat (limited to 'js/src/jit-test/tests/basic/truncateDouble.js')
-rw-r--r-- | js/src/jit-test/tests/basic/truncateDouble.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/truncateDouble.js b/js/src/jit-test/tests/basic/truncateDouble.js new file mode 100644 index 000000000..b5c499076 --- /dev/null +++ b/js/src/jit-test/tests/basic/truncateDouble.js @@ -0,0 +1,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); |