js/src/tests/ecma_6/Math/atanh-exact.js

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

mercurial