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