]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/math-pow-with-never-NaN-exponent.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / math-pow-with-never-NaN-exponent.js
CommitLineData
ed1e77d3
A
1function exponentIsNonNanDouble1(x, doubleArrayIndex) {
2 var doubleArray = [4.4];
3 return Math.pow(x, doubleArray[doubleArrayIndex]);
4}
5noInline(exponentIsNonNanDouble1);
6
7function exponentIsNonNanDouble2(x, doubleArray) {
8 return Math.pow(x, doubleArray[0]);
9}
10noInline(exponentIsNonNanDouble2);
11
12function testExponentIsDoubleConstant() {
13 for (var i = 0; i < 10000; ++i) {
14 var result = exponentIsNonNanDouble1(2, 0);
15 if (result !== 21.112126572366314)
16 throw "Error: exponentIsNonNanDouble1(2, 0) should be 21.112126572366314, was = " + result;
17 }
18 for (var i = 0; i < 10000; ++i) {
19 var result = exponentIsNonNanDouble2(3, [-1.5]);
20 if (result !== 0.19245008972987526)
21 throw "Error: exponentIsNonNanDouble2(3, [-1.5]) should be 0.19245008972987526, was = " + result;
22 }
23}
24testExponentIsDoubleConstant();