1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/jaeger/inline/mathSqrt.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 + 1.5 +assertEq(Math.sqrt(-Infinity), NaN); 1.6 +assertEq(Math.sqrt(-3.14), NaN); 1.7 +assertEq(Math.sqrt(-2), NaN); 1.8 +assertEq(Math.sqrt(-0), -0); 1.9 +assertEq(Math.sqrt(0), 0); 1.10 +assertEq(Math.sqrt(2), Math.SQRT2); 1.11 +assertEq(Math.sqrt(49), 7); 1.12 +assertEq(Math.sqrt(Infinity), Infinity); 1.13 + 1.14 +/* Inferred as sqrt(double). */ 1.15 +function sqrt1(x) { 1.16 + return Math.sqrt(x); 1.17 +} 1.18 +assertEq(sqrt1(NaN), NaN); 1.19 +assertEq(sqrt1(-Infinity), NaN); 1.20 +assertEq(sqrt1(Infinity), Infinity); 1.21 +assertEq(sqrt1(-0), -0); 1.22 +assertEq(sqrt1(2), Math.SQRT2); 1.23 +assertEq(sqrt1(16), 4); 1.24 + 1.25 +/* Inferred as sqrt(int). */ 1.26 +function sqrt2(x) { 1.27 + return Math.sqrt(x); 1.28 +} 1.29 +assertEq(sqrt2(4), 2); 1.30 +assertEq(sqrt2(169), 13); 1.31 +assertEq(sqrt2(0), 0); 1.32 +