]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/double-as-int32.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / double-as-int32.js
1 //@ defaultRun; runNoCJITNoASO
2
3 function foo(a, b) {
4 return a.f / b.f;
5 }
6
7 noInline(foo);
8
9 function test(a, b, e) {
10 var result = foo({f:a}, {f:b});
11 if (result != e)
12 throw "Error: " + a + " / " + b + " should be " + e + " but was " + result;
13 }
14
15 for (var i = 1; i < 101; ++i)
16 test(i * 2, i, 2);
17
18 test(9, 3, 3);
19 test(12, 4, 3);
20 test(-32, 8, -4);
21 test(-21, 7, -3);
22 test(7, 2, 3.5);