summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/truncateDouble.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/jit-test/tests/basic/truncateDouble.js10
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 0000000000..b5c4990768
--- /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);