1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_6/Math/log1p-exact.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +// Properties of Math.log1p that are guaranteed by the spec. 1.5 + 1.6 +// If x is NaN, the result is NaN. 1.7 +assertEq(Math.log1p(NaN), NaN); 1.8 + 1.9 +// If x is less than -1, the result is NaN. 1.10 +assertEq(Math.log1p(-1 - 1e-10), NaN); 1.11 +assertEq(Math.log1p(-1 - 1e-5), NaN); 1.12 +assertEq(Math.log1p(-1 - 1e-1), NaN); 1.13 +assertEq(Math.log1p(-ONE_PLUS_EPSILON), NaN); 1.14 + 1.15 +for (var i = -2; i > -20; i--) 1.16 + assertEq(Math.log1p(i), NaN); 1.17 + 1.18 +// If x is -1, the result is -∞. 1.19 +assertEq(Math.log1p(-1), -Infinity); 1.20 + 1.21 +// If x is +0, the result is +0. 1.22 +assertEq(Math.log1p(+0), +0); 1.23 + 1.24 +// If x is −0, the result is −0. 1.25 +assertEq(Math.log1p(-0), -0); 1.26 + 1.27 +// If x is +∞, the result is +∞. 1.28 +assertEq(Math.log1p(Infinity), Infinity); 1.29 + 1.30 + 1.31 +reportCompare(0, 0, "ok"); 1.32 +