]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/float32-array-nan.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / float32-array-nan.js
CommitLineData
81345200
A
1function foo(o) {
2 return o[0];
3}
4
5noInline(foo);
6
7function test(a, x) {
8 var intArray = new Int32Array(1);
9 intArray[0] = a;
10 var floatArray = new Float32Array(intArray.buffer);
11 var element = foo(floatArray);
12 var result = element + 1;
13 if (("" + result) != ("" + x))
14 throw "Error: bad result for " + a + ": " + result + ", but expected: " + x + "; loaded " + element + " from the array";
15}
16
17for (var i = 0; i < 100000; ++i)
18 test(0, 1);
19
20test(0xFFFF0000, 0/0);