js/src/jit-test/tests/basic/math-jit-tests.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/math-jit-tests.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,520 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +
     1.6 +// Apply FUNCNAME to ARGS, and check against EXPECTED.
     1.7 +// Expect a loop containing such a call to be traced.
     1.8 +// FUNCNAME and ARGS are both strings.
     1.9 +// ARGS has the form of an argument list: a comma-separated list of expressions.
    1.10 +// Certain Tracemonkey limitations require us to pass FUNCNAME as a string.
    1.11 +// Passing ARGS as a string allows us to assign better test names:
    1.12 +// expressions like Math.PI/4 haven't been evaluated to big hairy numbers.
    1.13 +function testmath(funcname, args, expected) {
    1.14 +    var i, j;
    1.15 +
    1.16 +    var arg_value_list = eval("[" + args + "]");
    1.17 +    var arity = arg_value_list.length;
    1.18 +
    1.19 +    // Build the string "a[i][0],...,a[i][ARITY-1]".
    1.20 +    var actuals = []
    1.21 +    for (i = 0; i < arity; i++)
    1.22 +        actuals.push("a[i][" + i + "]");
    1.23 +    actuals = actuals.join(",");
    1.24 +
    1.25 +    // Create a function that maps FUNCNAME across an array of input values.
    1.26 +    // Unless we eval here, the call to funcname won't get traced.
    1.27 +    // FUNCNAME="Infinity/Math.abs" and cases like that happen to
    1.28 +    // parse, too, in a twisted way.
    1.29 +    var mapfunc = eval("(function(a) {\n"
    1.30 +                       + "   for (var i = 0; i < a.length; i++)\n"
    1.31 +                       + "       a[i] = " + funcname + "(" + actuals +");\n"
    1.32 +                       + " })\n");
    1.33 +
    1.34 +    // To prevent the compiler from doing constant folding, produce an
    1.35 +    // array to pass to mapfunc that contains enough dummy
    1.36 +    // values at the front to get the loop body jitted, and then our
    1.37 +    // actual test value.
    1.38 +    var dummies_and_input = [];
    1.39 +    for (i = 0; i < 9; i++) {
    1.40 +        var dummy_list = [];
    1.41 +        for (j = 0; j < arity; j++)
    1.42 +            dummy_list[j] = .0078125 * ((i + j) % 128);
    1.43 +        dummies_and_input[i] = dummy_list;
    1.44 +    }
    1.45 +    dummies_and_input[9] = arg_value_list;
    1.46 +
    1.47 +    function testfunc() {
    1.48 +        // Map the function across the dummy values and the test input.
    1.49 +        mapfunc(dummies_and_input);
    1.50 +        return dummies_and_input[9];
    1.51 +    }
    1.52 +
    1.53 +    assertEq(close_enough(testfunc(), expected), true);
    1.54 +}
    1.55 +
    1.56 +function close_enough(expected, actual)
    1.57 +{
    1.58 +  if (typeof expected != typeof actual)
    1.59 +    return false;
    1.60 +  if (typeof expected != 'number')
    1.61 +    return actual == expected;
    1.62 +
    1.63 +  // Distinguish NaN from other values.  Using x != x comparisons here
    1.64 +  // works even if tests redefine isNaN.
    1.65 +  if (actual != actual)
    1.66 +    return expected != expected
    1.67 +  if (expected != expected)
    1.68 +    return false;
    1.69 +
    1.70 +  // Tolerate a certain degree of error.
    1.71 +  if (actual != expected)
    1.72 +    return Math.abs(actual - expected) <= 1E-10;
    1.73 +
    1.74 +  // Distinguish 0 and -0.
    1.75 +  if (actual == 0)
    1.76 +    return (1 / actual > 0) == (1 / expected > 0);
    1.77 +
    1.78 +  return true;
    1.79 +}
    1.80 +
    1.81 +testmath("Math.abs", "void 0", Number.NaN)
    1.82 +testmath("Math.abs", "null", 0)
    1.83 +testmath("Math.abs", "true", 1)
    1.84 +testmath("Math.abs", "false", 0)
    1.85 +testmath("Math.abs", "\"a string primitive\"", Number.NaN)
    1.86 +testmath("Math.abs", "new String( 'a String object' )", Number.NaN)
    1.87 +testmath("Math.abs", "Number.NaN", Number.NaN)
    1.88 +testmath("Math.abs", "0", 0)
    1.89 +testmath("Math.abs", "-0", 0)
    1.90 +testmath("Infinity/Math.abs", "-0", Infinity)
    1.91 +testmath("Math.abs", "Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
    1.92 +testmath("Math.abs", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    1.93 +testmath("Math.abs", "- Number.MAX_VALUE", Number.MAX_VALUE)
    1.94 +testmath("Math.abs", "-Number.MIN_VALUE", Number.MIN_VALUE)
    1.95 +testmath("Math.abs", "Number.MAX_VALUE", Number.MAX_VALUE)
    1.96 +testmath("Math.abs", "Number.MIN_VALUE", Number.MIN_VALUE)
    1.97 +testmath("Math.abs", "-1", 1)
    1.98 +testmath("Math.abs", "new Number(-1)", 1)
    1.99 +testmath("Math.abs", "1", 1)
   1.100 +testmath("Math.abs", "Math.PI", Math.PI)
   1.101 +testmath("Math.abs", "-Math.PI", Math.PI)
   1.102 +testmath("Math.abs", "-1/100000000", 1/100000000)
   1.103 +testmath("Math.abs", "-Math.pow(2,32)", Math.pow(2,32))
   1.104 +testmath("Math.abs", "Math.pow(2,32)", Math.pow(2,32))
   1.105 +testmath("Math.abs", "-0xfff", 4095)
   1.106 +testmath("Math.abs", "-0777", 511)
   1.107 +testmath("Math.abs", "'-1e-1'", 0.1)
   1.108 +testmath("Math.abs", "'0xff'", 255)
   1.109 +testmath("Math.abs", "'077'", 77)
   1.110 +testmath("Math.abs", "'Infinity'", Infinity)
   1.111 +testmath("Math.abs", "'-Infinity'", Infinity)
   1.112 +
   1.113 +testmath("Math.acos", "void 0", Number.NaN)
   1.114 +testmath("Math.acos", "null", Math.PI/2)
   1.115 +testmath("Math.acos", "Number.NaN", Number.NaN)
   1.116 +testmath("Math.acos", "\"a string\"", Number.NaN)
   1.117 +testmath("Math.acos", "'0'", Math.PI/2)
   1.118 +testmath("Math.acos", "'1'", 0)
   1.119 +testmath("Math.acos", "'-1'", Math.PI)
   1.120 +testmath("Math.acos", "1.00000001", Number.NaN)
   1.121 +testmath("Math.acos", "-1.00000001", Number.NaN)
   1.122 +testmath("Math.acos", "1", 0)
   1.123 +testmath("Math.acos", "-1", Math.PI)
   1.124 +testmath("Math.acos", "0", Math.PI/2)
   1.125 +testmath("Math.acos", "-0", Math.PI/2)
   1.126 +testmath("Math.acos", "Math.SQRT1_2", Math.PI/4)
   1.127 +testmath("Math.acos", "-Math.SQRT1_2", Math.PI/4*3)
   1.128 +testmath("Math.acos", "0.9999619230642", Math.PI/360)
   1.129 +testmath("Math.acos", "-3.0", Number.NaN)
   1.130 +
   1.131 +testmath("Math.asin", "void 0", Number.NaN)
   1.132 +testmath("Math.asin", "null", 0)
   1.133 +testmath("Math.asin", "Number.NaN", Number.NaN)
   1.134 +testmath("Math.asin", "\"string\"", Number.NaN)
   1.135 +testmath("Math.asin", "\"0\"", 0)
   1.136 +testmath("Math.asin", "\"1\"", Math.PI/2)
   1.137 +testmath("Math.asin", "\"-1\"", -Math.PI/2)
   1.138 +testmath("Math.asin", "Math.SQRT1_2+''", Math.PI/4)
   1.139 +testmath("Math.asin", "-Math.SQRT1_2+''", -Math.PI/4)
   1.140 +testmath("Math.asin", "1.000001", Number.NaN)
   1.141 +testmath("Math.asin", "-1.000001", Number.NaN)
   1.142 +testmath("Math.asin", "0", 0)
   1.143 +testmath("Math.asin", "-0", -0)
   1.144 +testmath("Infinity/Math.asin", "-0", -Infinity)
   1.145 +testmath("Math.asin", "1", Math.PI/2)
   1.146 +testmath("Math.asin", "-1", -Math.PI/2)
   1.147 +testmath("Math.asin", "Math.SQRT1_2", Math.PI/4)
   1.148 +testmath("Math.asin", "-Math.SQRT1_2", -Math.PI/4)
   1.149 +
   1.150 +testmath("Math.atan", "void 0", Number.NaN)
   1.151 +testmath("Math.atan", "null", 0)
   1.152 +testmath("Math.atan", "Number.NaN", Number.NaN)
   1.153 +testmath("Math.atan", "\"a string\"", Number.NaN)
   1.154 +testmath("Math.atan", "'0'", 0)
   1.155 +testmath("Math.atan", "'1'", Math.PI/4)
   1.156 +testmath("Math.atan", "'-1'", -Math.PI/4)
   1.157 +testmath("Math.atan", "'Infinity'", Math.PI/2)
   1.158 +testmath("Math.atan", "'-Infinity'", -Math.PI/2)
   1.159 +testmath("Math.atan", "0", 0)
   1.160 +testmath("Math.atan", "-0", -0)
   1.161 +testmath("Infinity/Math.atan", "-0", -Infinity)
   1.162 +testmath("Math.atan", "Number.POSITIVE_INFINITY", Math.PI/2)
   1.163 +testmath("Math.atan", "Number.NEGATIVE_INFINITY", -Math.PI/2)
   1.164 +testmath("Math.atan", "1", Math.PI/4)
   1.165 +testmath("Math.atan", "-1", -Math.PI/4)
   1.166 +
   1.167 +testmath("Math.atan2", "Number.NaN,0", Number.NaN)
   1.168 +testmath("Math.atan2", "null, null", 0)
   1.169 +testmath("Math.atan2", "void 0, void 0", Number.NaN)
   1.170 +testmath("Math.atan2", "0,Number.NaN", Number.NaN)
   1.171 +testmath("Math.atan2", "1,0", Math.PI/2)
   1.172 +testmath("Math.atan2", "1,-0", Math.PI/2)
   1.173 +testmath("Math.atan2", "0,0.001", 0)
   1.174 +testmath("Math.atan2", "0,0", 0)
   1.175 +testmath("Math.atan2", "0,-0", Math.PI)
   1.176 +testmath("Math.atan2", "0, -1", Math.PI)
   1.177 +testmath("Math.atan2", "-0, 1", -0)
   1.178 +testmath("Infinity/Math.atan2", "-0,1", -Infinity)
   1.179 +testmath("Math.atan2", "-0,0", -0)
   1.180 +testmath("Math.atan2", "-0, -0", -Math.PI)
   1.181 +testmath("Math.atan2", "-0, -1", -Math.PI)
   1.182 +testmath("Math.atan2", "-1, 0", -Math.PI/2)
   1.183 +testmath("Math.atan2", "-1, -0", -Math.PI/2)
   1.184 +testmath("Math.atan2", "1, Number.POSITIVE_INFINITY", 0)
   1.185 +testmath("Math.atan2", "1, Number.NEGATIVE_INFINITY", Math.PI)
   1.186 +testmath("Math.atan2", "-1,Number.POSITIVE_INFINITY", -0)
   1.187 +testmath("Infinity/Math.atan2", "-1,Infinity", -Infinity)
   1.188 +testmath("Math.atan2", "-1,Number.NEGATIVE_INFINITY", -Math.PI)
   1.189 +testmath("Math.atan2", "Number.POSITIVE_INFINITY, 0", Math.PI/2)
   1.190 +testmath("Math.atan2", "Number.POSITIVE_INFINITY, 1", Math.PI/2)
   1.191 +testmath("Math.atan2", "Number.POSITIVE_INFINITY,-1", Math.PI/2)
   1.192 +testmath("Math.atan2", "Number.POSITIVE_INFINITY,-0", Math.PI/2)
   1.193 +testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 0", -Math.PI/2)
   1.194 +testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-0", -Math.PI/2)
   1.195 +testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 1", -Math.PI/2)
   1.196 +testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-1", -Math.PI/2)
   1.197 +testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY", Math.PI/4)
   1.198 +testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY", 3*Math.PI/4)
   1.199 +testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", -Math.PI/4)
   1.200 +testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", -3*Math.PI/4)
   1.201 +testmath("Math.atan2", "-1, 1", -Math.PI/4)
   1.202 +
   1.203 +testmath("Math.ceil", "Number.NaN", Number.NaN)
   1.204 +testmath("Math.ceil", "null", 0)
   1.205 +testmath("Math.ceil", "void 0", Number.NaN)
   1.206 +testmath("Math.ceil", "'0'", 0)
   1.207 +testmath("Math.ceil", "'-0'", -0)
   1.208 +testmath("Infinity/Math.ceil", "'0'", Infinity)
   1.209 +testmath("Infinity/Math.ceil", "'-0'", -Infinity)
   1.210 +testmath("Math.ceil", "0", 0)
   1.211 +testmath("Math.ceil", "-0", -0)
   1.212 +testmath("Infinity/Math.ceil", "0", Infinity)
   1.213 +testmath("Infinity/Math.ceil", "-0", -Infinity)
   1.214 +testmath("Math.ceil", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.215 +testmath("Math.ceil", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
   1.216 +testmath("Math.ceil", "-Number.MIN_VALUE", -0)
   1.217 +testmath("Infinity/Math.ceil", "-Number.MIN_VALUE", -Infinity)
   1.218 +testmath("Math.ceil", "1", 1)
   1.219 +testmath("Math.ceil", "-1", -1)
   1.220 +testmath("Math.ceil", "-0.9", -0)
   1.221 +testmath("Infinity/Math.ceil", "-0.9", -Infinity)
   1.222 +testmath("Math.ceil", "0.9", 1)
   1.223 +testmath("Math.ceil", "-1.1", -1)
   1.224 +testmath("Math.ceil", "1.1", 2)
   1.225 +testmath("Math.ceil", "Number.POSITIVE_INFINITY", -Math.floor(-Infinity))
   1.226 +testmath("Math.ceil", "Number.NEGATIVE_INFINITY", -Math.floor(Infinity))
   1.227 +testmath("Math.ceil", "-Number.MIN_VALUE", -Math.floor(Number.MIN_VALUE))
   1.228 +testmath("Math.ceil", "1", -Math.floor(-1))
   1.229 +testmath("Math.ceil", "-1", -Math.floor(1))
   1.230 +testmath("Math.ceil", "-0.9", -Math.floor(0.9))
   1.231 +testmath("Math.ceil", "0.9", -Math.floor(-0.9))
   1.232 +testmath("Math.ceil", "-1.1", -Math.floor(1.1))
   1.233 +testmath("Math.ceil", "1.1", -Math.floor(-1.1))
   1.234 +
   1.235 +testmath("Math.cos", "void 0", Number.NaN)
   1.236 +testmath("Math.cos", "false", 1)
   1.237 +testmath("Math.cos", "null", 1)
   1.238 +testmath("Math.cos", "'0'", 1)
   1.239 +testmath("Math.cos", "\"Infinity\"", Number.NaN)
   1.240 +testmath("Math.cos", "'3.14159265359'", -1)
   1.241 +testmath("Math.cos", "Number.NaN", Number.NaN)
   1.242 +testmath("Math.cos", "0", 1)
   1.243 +testmath("Math.cos", "-0", 1)
   1.244 +testmath("Math.cos", "Number.POSITIVE_INFINITY", Number.NaN)
   1.245 +testmath("Math.cos", "Number.NEGATIVE_INFINITY", Number.NaN)
   1.246 +testmath("Math.cos", "0.7853981633974", 0.7071067811865)
   1.247 +testmath("Math.cos", "1.570796326795", 0)
   1.248 +testmath("Math.cos", "2.356194490192", -0.7071067811865)
   1.249 +testmath("Math.cos", "3.14159265359", -1)
   1.250 +testmath("Math.cos", "3.926990816987", -0.7071067811865)
   1.251 +testmath("Math.cos", "4.712388980385", 0)
   1.252 +testmath("Math.cos", "5.497787143782", 0.7071067811865)
   1.253 +testmath("Math.cos", "Math.PI*2", 1)
   1.254 +testmath("Math.cos", "Math.PI/4", Math.SQRT2/2)
   1.255 +testmath("Math.cos", "Math.PI/2", 0)
   1.256 +testmath("Math.cos", "3*Math.PI/4", -Math.SQRT2/2)
   1.257 +testmath("Math.cos", "Math.PI", -1)
   1.258 +testmath("Math.cos", "5*Math.PI/4", -Math.SQRT2/2)
   1.259 +testmath("Math.cos", "3*Math.PI/2", 0)
   1.260 +testmath("Math.cos", "7*Math.PI/4", Math.SQRT2/2)
   1.261 +testmath("Math.cos", "2*Math.PI", 1)
   1.262 +testmath("Math.cos", "-0.7853981633974", 0.7071067811865)
   1.263 +testmath("Math.cos", "-1.570796326795", 0)
   1.264 +testmath("Math.cos", "2.3561944901920", -.7071067811865)
   1.265 +testmath("Math.cos", "3.14159265359", -1)
   1.266 +testmath("Math.cos", "3.926990816987", -0.7071067811865)
   1.267 +testmath("Math.cos", "4.712388980385", 0)
   1.268 +testmath("Math.cos", "5.497787143782", 0.7071067811865)
   1.269 +testmath("Math.cos", "6.28318530718", 1)
   1.270 +testmath("Math.cos", "-Math.PI/4", Math.SQRT2/2)
   1.271 +testmath("Math.cos", "-Math.PI/2", 0)
   1.272 +testmath("Math.cos", "-3*Math.PI/4", -Math.SQRT2/2)
   1.273 +testmath("Math.cos", "-Math.PI", -1)
   1.274 +testmath("Math.cos", "-5*Math.PI/4", -Math.SQRT2/2)
   1.275 +testmath("Math.cos", "-3*Math.PI/2", 0)
   1.276 +testmath("Math.cos", "-7*Math.PI/4", Math.SQRT2/2)
   1.277 +testmath("Math.cos", "-Math.PI*2", 1)
   1.278 +
   1.279 +testmath("Math.exp", "null", 1)
   1.280 +testmath("Math.exp", "void 0", Number.NaN)
   1.281 +testmath("Math.exp", "1", Math.E)
   1.282 +testmath("Math.exp", "true", Math.E)
   1.283 +testmath("Math.exp", "false", 1)
   1.284 +testmath("Math.exp", "'1'", Math.E)
   1.285 +testmath("Math.exp", "'0'", 1)
   1.286 +testmath("Math.exp", "Number.NaN", Number.NaN)
   1.287 +testmath("Math.exp", "0", 1)
   1.288 +testmath("Math.exp", "-0", 1)
   1.289 +testmath("Math.exp", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.290 +testmath("Math.exp", "Number.NEGATIVE_INFINITY", 0)
   1.291 +
   1.292 +testmath("Math.floor", "void 0", Number.NaN)
   1.293 +testmath("Math.floor", "null", 0)
   1.294 +testmath("Math.floor", "true", 1)
   1.295 +testmath("Math.floor", "false", 0)
   1.296 +testmath("Math.floor", "\"1.1\"", 1)
   1.297 +testmath("Math.floor", "\"-1.1\"", -2)
   1.298 +testmath("Math.floor", "\"0.1\"", 0)
   1.299 +testmath("Math.floor", "\"-0.1\"", -1)
   1.300 +testmath("Math.floor", "Number.NaN", Number.NaN)
   1.301 +testmath("Math.floor(Number.NaN) == -Math.ceil", "-Number.NaN", false)
   1.302 +testmath("Math.floor", "0", 0)
   1.303 +testmath("Math.floor(0) == -Math.ceil", "-0", true)
   1.304 +testmath("Math.floor", "-0", -0)
   1.305 +testmath("Infinity/Math.floor", "-0", -Infinity)
   1.306 +testmath("Math.floor(-0)== -Math.ceil", "0", true)
   1.307 +testmath("Math.floor", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.308 +testmath("Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil", "Number.NEGATIVE_INFINITY", true)
   1.309 +testmath("Math.floor", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
   1.310 +testmath("Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil", "Number.POSITIVE_INFINITY", true)
   1.311 +testmath("Math.floor", "0.0000001", 0)
   1.312 +testmath("Math.floor(0.0000001)==-Math.ceil", "-0.0000001", true)
   1.313 +testmath("Math.floor", "-0.0000001", -1)
   1.314 +testmath("Math.floor(-0.0000001)==-Math.ceil", "0.0000001", true)
   1.315 +
   1.316 +testmath("Math.log", "void 0", Number.NaN)
   1.317 +testmath("Math.log", "null", Number.NEGATIVE_INFINITY)
   1.318 +testmath("Math.log", "true", 0)
   1.319 +testmath("Math.log", "false", -Infinity)
   1.320 +testmath("Math.log", "'0'", -Infinity)
   1.321 +testmath("Math.log", "'1'", 0)
   1.322 +testmath("Math.log", "\"Infinity\"", Infinity)
   1.323 +testmath("Math.log", "Number.NaN", Number.NaN)
   1.324 +testmath("Math.log", "-0.000001", Number.NaN)
   1.325 +testmath("Math.log", "-1", Number.NaN)
   1.326 +testmath("Math.log", "0", Number.NEGATIVE_INFINITY)
   1.327 +testmath("Math.log", "-0", Number.NEGATIVE_INFINITY)
   1.328 +testmath("Math.log", "1", 0)
   1.329 +testmath("Math.log", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.330 +testmath("Math.log", "Number.NEGATIVE_INFINITY", Number.NaN)
   1.331 +
   1.332 +testmath("Math.max", "void 0, 1", Number.NaN)
   1.333 +testmath("Math.max", "void 0, void 0", Number.NaN)
   1.334 +testmath("Math.max", "null, 1", 1)
   1.335 +testmath("Math.max", "-1, null", 0)
   1.336 +testmath("Math.max", "true,false", 1)
   1.337 +testmath("Math.max", "\"-99\",\"99\"", 99)
   1.338 +testmath("Math.max", "Number.NaN,Number.POSITIVE_INFINITY", Number.NaN)
   1.339 +testmath("Math.max", "Number.NaN, 0", Number.NaN)
   1.340 +testmath("Math.max", "\"a string\", 0", Number.NaN)
   1.341 +testmath("Math.max", "Number.NaN,1", Number.NaN)
   1.342 +testmath("Math.max", "\"a string\", Number.POSITIVE_INFINITY", Number.NaN)
   1.343 +testmath("Math.max", "Number.POSITIVE_INFINITY, Number.NaN", Number.NaN)
   1.344 +testmath("Math.max", "Number.NaN, Number.NaN", Number.NaN)
   1.345 +testmath("Math.max", "0,Number.NaN", Number.NaN)
   1.346 +testmath("Math.max", "1, Number.NaN", Number.NaN)
   1.347 +testmath("Math.max", "0,0", 0)
   1.348 +testmath("Math.max", "0,-0", 0)
   1.349 +testmath("Math.max", "-0,0", 0)
   1.350 +testmath("Math.max", "-0,-0", -0)
   1.351 +testmath("Infinity/Math.max", "-0,-0", -Infinity)
   1.352 +testmath("Math.max", "Number.POSITIVE_INFINITY, Number.MAX_VALUE", Number.POSITIVE_INFINITY)
   1.353 +testmath("Math.max", "Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.354 +testmath("Math.max", "Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
   1.355 +testmath("Math.max", "1,.99999999999999", 1)
   1.356 +testmath("Math.max", "-1,-.99999999999999", -.99999999999999)
   1.357 +
   1.358 +testmath("Math.min", "void 0, 1", Number.NaN)
   1.359 +testmath("Math.min", "void 0, void 0", Number.NaN)
   1.360 +testmath("Math.min", "null, 1", 0)
   1.361 +testmath("Math.min", "-1, null", -1)
   1.362 +testmath("Math.min", "true,false", 0)
   1.363 +testmath("Math.min", "\"-99\",\"99\"", -99)
   1.364 +testmath("Math.min", "Number.NaN,0", Number.NaN)
   1.365 +testmath("Math.min", "Number.NaN,1", Number.NaN)
   1.366 +testmath("Math.min", "Number.NaN,-1", Number.NaN)
   1.367 +testmath("Math.min", "0,Number.NaN", Number.NaN)
   1.368 +testmath("Math.min", "1,Number.NaN", Number.NaN)
   1.369 +testmath("Math.min", "-1,Number.NaN", Number.NaN)
   1.370 +testmath("Math.min", "Number.NaN,Number.NaN", Number.NaN)
   1.371 +testmath("Math.min", "1,1.0000000001", 1)
   1.372 +testmath("Math.min", "1.0000000001,1", 1)
   1.373 +testmath("Math.min", "0,0", 0)
   1.374 +testmath("Math.min", "0,-0", -0)
   1.375 +testmath("Math.min", "-0,-0", -0)
   1.376 +testmath("Infinity/Math.min", "0,-0", -Infinity)
   1.377 +testmath("Infinity/Math.min", "-0,-0", -Infinity)
   1.378 +
   1.379 +testmath("Math.pow", "null,null", 1)
   1.380 +testmath("Math.pow", "void 0, void 0", Number.NaN)
   1.381 +testmath("Math.pow", "true, false", 1)
   1.382 +testmath("Math.pow", "false,true", 0)
   1.383 +testmath("Math.pow", "'2','32'", 4294967296)
   1.384 +testmath("Math.pow", "1,Number.NaN", Number.NaN)
   1.385 +testmath("Math.pow", "0,Number.NaN", Number.NaN)
   1.386 +testmath("Math.pow", "Number.NaN,0", 1)
   1.387 +testmath("Math.pow", "Number.NaN,-0", 1)
   1.388 +testmath("Math.pow", "Number.NaN, 1", Number.NaN)
   1.389 +testmath("Math.pow", "Number.NaN, .5", Number.NaN)
   1.390 +testmath("Math.pow", "1.00000001, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.391 +testmath("Math.pow", "1.00000001, Number.NEGATIVE_INFINITY", 0)
   1.392 +testmath("Math.pow", "-1.00000001,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.393 +testmath("Math.pow", "-1.00000001,Number.NEGATIVE_INFINITY", 0)
   1.394 +testmath("Math.pow", "1, Number.POSITIVE_INFINITY", Number.NaN)
   1.395 +testmath("Math.pow", "1, Number.NEGATIVE_INFINITY", Number.NaN)
   1.396 +testmath("Math.pow", "-1, Number.POSITIVE_INFINITY", Number.NaN)
   1.397 +testmath("Math.pow", "-1, Number.NEGATIVE_INFINITY", Number.NaN)
   1.398 +testmath("Math.pow", ".0000000009, Number.POSITIVE_INFINITY", 0)
   1.399 +testmath("Math.pow", "-.0000000009, Number.POSITIVE_INFINITY", 0)
   1.400 +testmath("Math.pow", "-.0000000009, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.401 +testmath("Math.pow", "Number.POSITIVE_INFINITY,.00000000001", Number.POSITIVE_INFINITY)
   1.402 +testmath("Math.pow", "Number.POSITIVE_INFINITY, 1", Number.POSITIVE_INFINITY)
   1.403 +testmath("Math.pow", "Number.POSITIVE_INFINITY, -.00000000001", 0)
   1.404 +testmath("Math.pow", "Number.POSITIVE_INFINITY, -1", 0)
   1.405 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, 1", Number.NEGATIVE_INFINITY)
   1.406 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, 333", Number.NEGATIVE_INFINITY)
   1.407 +testmath("Math.pow", "Number.POSITIVE_INFINITY, 2", Number.POSITIVE_INFINITY)
   1.408 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, 666", Number.POSITIVE_INFINITY)
   1.409 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, 0.5", Number.POSITIVE_INFINITY)
   1.410 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.411 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, -1", -0)
   1.412 +testmath("Infinity/Math.pow", "Number.NEGATIVE_INFINITY, -1", -Infinity)
   1.413 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, -3", -0)
   1.414 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, -2", 0)
   1.415 +testmath("Math.pow", "Number.NEGATIVE_INFINITY,-0.5", 0)
   1.416 +testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", 0)
   1.417 +testmath("Math.pow", "0,1", 0)
   1.418 +testmath("Math.pow", "0,0", 1)
   1.419 +testmath("Math.pow", "1,0", 1)
   1.420 +testmath("Math.pow", "-1,0", 1)
   1.421 +testmath("Math.pow", "0,0.5", 0)
   1.422 +testmath("Math.pow", "0,1000", 0)
   1.423 +testmath("Math.pow", "0, Number.POSITIVE_INFINITY", 0)
   1.424 +testmath("Math.pow", "0, -1", Number.POSITIVE_INFINITY)
   1.425 +testmath("Math.pow", "0, -0.5", Number.POSITIVE_INFINITY)
   1.426 +testmath("Math.pow", "0, -1000", Number.POSITIVE_INFINITY)
   1.427 +testmath("Math.pow", "0, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.428 +testmath("Math.pow", "-0, 1", -0)
   1.429 +testmath("Math.pow", "-0,3", -0)
   1.430 +testmath("Infinity/Math.pow", "-0, 1", -Infinity)
   1.431 +testmath("Infinity/Math.pow", "-0,3", -Infinity)
   1.432 +testmath("Math.pow", "-0,2", 0)
   1.433 +testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0)
   1.434 +testmath("Math.pow", "-0, -1", Number.NEGATIVE_INFINITY)
   1.435 +testmath("Math.pow", "-0, -10001", Number.NEGATIVE_INFINITY)
   1.436 +testmath("Math.pow", "-0, -2", Number.POSITIVE_INFINITY)
   1.437 +testmath("Math.pow", "-0, 0.5", 0)
   1.438 +testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0)
   1.439 +testmath("Math.pow", "-1, 0.5", Number.NaN)
   1.440 +testmath("Math.pow", "-1, Number.NaN", Number.NaN)
   1.441 +testmath("Math.pow", "-1, -0.5", Number.NaN)
   1.442 +
   1.443 +testmath("Math.round", "0", 0)
   1.444 +testmath("Math.round", "void 0", Number.NaN)
   1.445 +testmath("Math.round", "true", 1)
   1.446 +testmath("Math.round", "false", 0)
   1.447 +testmath("Math.round", "'.99999'", 1)
   1.448 +testmath("Math.round", "'12345e-2'", 123)
   1.449 +testmath("Math.round", "Number.NaN", Number.NaN)
   1.450 +testmath("Math.round", "0", 0)
   1.451 +testmath("Math.round", "-0", -0)
   1.452 +testmath("Infinity/Math.round", "-0", -Infinity)
   1.453 +testmath("Math.round", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.454 +testmath("Math.round", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
   1.455 +testmath("Math.round", "0.49", 0)
   1.456 +testmath("Math.round", "0.5", 1)
   1.457 +testmath("Math.round", "0.51", 1)
   1.458 +testmath("Math.round", "-0.49", -0)
   1.459 +testmath("Math.round", "-0.5", -0)
   1.460 +testmath("Infinity/Math.round", "-0.49", -Infinity)
   1.461 +testmath("Infinity/Math.round", "-0.5", -Infinity)
   1.462 +testmath("Math.round", "-0.51", -1)
   1.463 +testmath("Math.round", "3.5", 4)
   1.464 +testmath("Math.round", "-3", -3)
   1.465 +
   1.466 +testmath("Math.sin", "null", 0)
   1.467 +testmath("Math.sin", "void 0", Number.NaN)
   1.468 +testmath("Math.sin", "false", 0)
   1.469 +testmath("Math.sin", "'2.356194490192'", 0.7071067811865)
   1.470 +testmath("Math.sin", "Number.NaN", Number.NaN)
   1.471 +testmath("Math.sin", "0", 0)
   1.472 +testmath("Math.sin", "-0", -0)
   1.473 +testmath("Math.sin", "Number.POSITIVE_INFINITY", Number.NaN)
   1.474 +testmath("Math.sin", "Number.NEGATIVE_INFINITY", Number.NaN)
   1.475 +testmath("Math.sin", "0.7853981633974", 0.7071067811865)
   1.476 +testmath("Math.sin", "1.570796326795", 1)
   1.477 +testmath("Math.sin", "2.356194490192", 0.7071067811865)
   1.478 +testmath("Math.sin", "3.14159265359", 0)
   1.479 +
   1.480 +testmath("Math.sqrt", "void 0", Number.NaN)
   1.481 +testmath("Math.sqrt", "null", 0)
   1.482 +testmath("Math.sqrt", "1", 1)
   1.483 +testmath("Math.sqrt", "false", 0)
   1.484 +testmath("Math.sqrt", "'225'", 15)
   1.485 +testmath("Math.sqrt", "Number.NaN", Number.NaN)
   1.486 +testmath("Math.sqrt", "Number.NEGATIVE_INFINITY", Number.NaN)
   1.487 +testmath("Math.sqrt", "-1", Number.NaN)
   1.488 +testmath("Math.sqrt", "-0.5", Number.NaN)
   1.489 +testmath("Math.sqrt", "0", 0)
   1.490 +testmath("Math.sqrt", "-0", -0)
   1.491 +testmath("Infinity/Math.sqrt", "-0", -Infinity)
   1.492 +testmath("Math.sqrt", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
   1.493 +testmath("Math.sqrt", "1", 1)
   1.494 +testmath("Math.sqrt", "2", Math.SQRT2)
   1.495 +testmath("Math.sqrt", "0.5", Math.SQRT1_2)
   1.496 +testmath("Math.sqrt", "4", 2)
   1.497 +testmath("Math.sqrt", "9", 3)
   1.498 +testmath("Math.sqrt", "16", 4)
   1.499 +testmath("Math.sqrt", "25", 5)
   1.500 +testmath("Math.sqrt", "36", 6)
   1.501 +testmath("Math.sqrt", "49", 7)
   1.502 +testmath("Math.sqrt", "64", 8)
   1.503 +testmath("Math.sqrt", "256", 16)
   1.504 +testmath("Math.sqrt", "10000", 100)
   1.505 +testmath("Math.sqrt", "65536", 256)
   1.506 +testmath("Math.sqrt", "0.09", 0.3)
   1.507 +testmath("Math.sqrt", "0.01", 0.1)
   1.508 +testmath("Math.sqrt", "0.00000001", 0.0001)
   1.509 +
   1.510 +testmath("Math.tan", "void 0", Number.NaN)
   1.511 +testmath("Math.tan", "null", 0)
   1.512 +testmath("Math.tan", "false", 0)
   1.513 +testmath("Math.tan", "Number.NaN", Number.NaN)
   1.514 +testmath("Math.tan", "0", 0)
   1.515 +testmath("Math.tan", "-0", -0)
   1.516 +testmath("Math.tan", "Number.POSITIVE_INFINITY", Number.NaN)
   1.517 +testmath("Math.tan", "Number.NEGATIVE_INFINITY", Number.NaN)
   1.518 +testmath("Math.tan", "Math.PI/4", 1)
   1.519 +testmath("Math.tan", "3*Math.PI/4", -1)
   1.520 +testmath("Math.tan", "Math.PI", -0)
   1.521 +testmath("Math.tan", "5*Math.PI/4", 1)
   1.522 +testmath("Math.tan", "7*Math.PI/4", -1)
   1.523 +testmath("Infinity/Math.tan", "-0", -Infinity)

mercurial