]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/math-pow-with-never-NaN-exponent.js
1 function exponentIsNonNanDouble1(x
, doubleArrayIndex
) {
2 var doubleArray
= [4.4];
3 return Math
.pow(x
, doubleArray
[doubleArrayIndex
]);
5 noInline(exponentIsNonNanDouble1
);
7 function exponentIsNonNanDouble2(x
, doubleArray
) {
8 return Math
.pow(x
, doubleArray
[0]);
10 noInline(exponentIsNonNanDouble2
);
12 function 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
;
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
;
24 testExponentIsDoubleConstant();