tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

math-jit-tests.js (23512B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 //-----------------------------------------------------------------------------
      7 var BUGNUMBER = 'none';
      8 var summary = 'trace-capability math mini-testsuite';
      9 
     10 printBugNumber(BUGNUMBER);
     11 printStatus (summary);
     12 
     13 // The loop count at which we trace
     14 const RECORDLOOP = 8;
     15 // The loop count at which we run the trace
     16 const RUNLOOP = RECORDLOOP + 1;
     17 
     18 var testName = null;
     19 if ("arguments" in this && arguments.length > 0)
     20  testName = arguments[0];
     21 
     22 function test(f)
     23 {
     24  if (!testName || testName == f.testname) {
     25    check(f.testname, f(), f.expected);
     26  }
     27 }
     28 
     29 function check(desc, actual, expected)
     30 {
     31  // Distinguish 0 and -0.
     32  if (actual === 0 && expected === 0) {
     33    actual = (1 / actual > 0) ? "+0" : "-0";
     34    expected = (1 / expected > 0) ? "+0" : "-0";
     35  }
     36 
     37  reportCompare(expected, actual, desc);
     38 }
     39 
     40 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     41 
     42 // Apply FUNCNAME to ARGS, and check against EXPECTED.
     43 // Expect a loop containing such a call to be traced.
     44 // FUNCNAME and ARGS are both strings.
     45 // ARGS has the form of an argument list: a comma-separated list of expressions.
     46 // Passing ARGS as a string allows us to assign better test names:
     47 // expressions like Math.PI/4 haven't been evaluated to big hairy numbers.
     48 function testmath(funcname, args, expected) {
     49    var i, j;
     50 
     51    var arg_value_list = eval("[" + args + "]");
     52    var arity = arg_value_list.length;
     53 
     54    // Build the string "a[i][0],...,a[i][ARITY-1]".
     55    var actuals = []
     56    for (i = 0; i < arity; i++)
     57        actuals.push("a[i][" + i + "]");
     58    actuals = actuals.join(",");
     59 
     60    // Create a function that maps FUNCNAME across an array of input values.
     61    // Unless we eval here, the call to funcname won't get traced.
     62    // FUNCNAME="Infinity/Math.abs" and cases like that happen to
     63    // parse, too, in a twisted way.
     64    var mapfunc = eval("(function(a) {\n"
     65                       + "   for (var i = 0; i < a.length; i++)\n"
     66                       + "       a[i] = " + funcname + "(" + actuals +");\n"
     67                       + " })\n");
     68 
     69    // To prevent the compiler from doing constant folding, produce an
     70    // array to pass to mapfunc that contains enough dummy
     71    // values at the front to get the loop body jitted, and then our
     72    // actual test value.
     73    var dummies_and_input = [];
     74    for (i = 0; i < RUNLOOP; i++) {
     75        var dummy_list = [];
     76        for (j = 0; j < arity; j++)
     77            dummy_list[j] = .0078125 * ((i + j) % 128);
     78        dummies_and_input[i] = dummy_list;
     79    }
     80    dummies_and_input[RUNLOOP] = arg_value_list;
     81 
     82    function testfunc() {
     83        // Map the function across the dummy values and the test input.
     84        mapfunc(dummies_and_input);
     85        return dummies_and_input[RUNLOOP];
     86    }
     87    testfunc.testname = funcname + "(" + args + ")";
     88    testfunc.expected = expected;
     89 
     90    test(testfunc);
     91 }
     92 
     93 testmath("Math.abs", "void 0", Number.NaN)
     94 testmath("Math.abs", "null", 0)
     95 testmath("Math.abs", "true", 1)
     96 testmath("Math.abs", "false", 0)
     97 testmath("Math.abs", "\"a string primitive\"", Number.NaN)
     98 testmath("Math.abs", "new String( 'a String object' )", Number.NaN)
     99 testmath("Math.abs", "Number.NaN", Number.NaN)
    100 testmath("Math.abs", "0", 0)
    101 testmath("Math.abs", "-0", 0)
    102 testmath("Infinity/Math.abs", "-0", Infinity)
    103 testmath("Math.abs", "Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
    104 testmath("Math.abs", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    105 testmath("Math.abs", "- Number.MAX_VALUE", Number.MAX_VALUE)
    106 testmath("Math.abs", "-Number.MIN_VALUE", Number.MIN_VALUE)
    107 testmath("Math.abs", "Number.MAX_VALUE", Number.MAX_VALUE)
    108 testmath("Math.abs", "Number.MIN_VALUE", Number.MIN_VALUE)
    109 testmath("Math.abs", "-1", 1)
    110 testmath("Math.abs", "new Number(-1)", 1)
    111 testmath("Math.abs", "1", 1)
    112 testmath("Math.abs", "Math.PI", Math.PI)
    113 testmath("Math.abs", "-Math.PI", Math.PI)
    114 testmath("Math.abs", "-1/100000000", 1/100000000)
    115 testmath("Math.abs", "-Math.pow(2,32)", Math.pow(2,32))
    116 testmath("Math.abs", "Math.pow(2,32)", Math.pow(2,32))
    117 testmath("Math.abs", "-0xfff", 4095)
    118 testmath("Math.abs", "-0777", 511)
    119 testmath("Math.abs", "'-1e-1'", 0.1)
    120 testmath("Math.abs", "'0xff'", 255)
    121 testmath("Math.abs", "'077'", 77)
    122 testmath("Math.abs", "'Infinity'", Infinity)
    123 testmath("Math.abs", "'-Infinity'", Infinity)
    124 
    125 testmath("Math.acos", "void 0", Number.NaN)
    126 testmath("Math.acos", "null", Math.PI/2)
    127 testmath("Math.acos", "Number.NaN", Number.NaN)
    128 testmath("Math.acos", "\"a string\"", Number.NaN)
    129 testmath("Math.acos", "'0'", Math.PI/2)
    130 testmath("Math.acos", "'1'", 0)
    131 testmath("Math.acos", "'-1'", Math.PI)
    132 testmath("Math.acos", "1.00000001", Number.NaN)
    133 testmath("Math.acos", "-1.00000001", Number.NaN)
    134 testmath("Math.acos", "1", 0)
    135 testmath("Math.acos", "-1", Math.PI)
    136 testmath("Math.acos", "0", Math.PI/2)
    137 testmath("Math.acos", "-0", Math.PI/2)
    138 testmath("Math.acos", "Math.SQRT1_2", Math.PI/4)
    139 testmath("Math.acos", "-Math.SQRT1_2", Math.PI/4*3)
    140 testmath("Math.acos", "0.9999619230642", Math.PI/360)
    141 testmath("Math.acos", "-3.0", Number.NaN)
    142 
    143 testmath("Math.asin", "void 0", Number.NaN)
    144 testmath("Math.asin", "null", 0)
    145 testmath("Math.asin", "Number.NaN", Number.NaN)
    146 testmath("Math.asin", "\"string\"", Number.NaN)
    147 testmath("Math.asin", "\"0\"", 0)
    148 testmath("Math.asin", "\"1\"", Math.PI/2)
    149 testmath("Math.asin", "\"-1\"", -Math.PI/2)
    150 testmath("Math.asin", "Math.SQRT1_2+''", Math.PI/4)
    151 testmath("Math.asin", "-Math.SQRT1_2+''", -Math.PI/4)
    152 testmath("Math.asin", "1.000001", Number.NaN)
    153 testmath("Math.asin", "-1.000001", Number.NaN)
    154 testmath("Math.asin", "0", 0)
    155 testmath("Math.asin", "-0", -0)
    156 testmath("Infinity/Math.asin", "-0", -Infinity)
    157 testmath("Math.asin", "1", Math.PI/2)
    158 testmath("Math.asin", "-1", -Math.PI/2)
    159 testmath("Math.asin", "Math.SQRT1_2", Math.PI/4)
    160 testmath("Math.asin", "-Math.SQRT1_2", -Math.PI/4)
    161 
    162 testmath("Math.atan", "void 0", Number.NaN)
    163 testmath("Math.atan", "null", 0)
    164 testmath("Math.atan", "Number.NaN", Number.NaN)
    165 testmath("Math.atan", "\"a string\"", Number.NaN)
    166 testmath("Math.atan", "'0'", 0)
    167 testmath("Math.atan", "'1'", Math.PI/4)
    168 testmath("Math.atan", "'-1'", -Math.PI/4)
    169 testmath("Math.atan", "'Infinity'", Math.PI/2)
    170 testmath("Math.atan", "'-Infinity'", -Math.PI/2)
    171 testmath("Math.atan", "0", 0)
    172 testmath("Math.atan", "-0", -0)
    173 testmath("Infinity/Math.atan", "-0", -Infinity)
    174 testmath("Math.atan", "Number.POSITIVE_INFINITY", Math.PI/2)
    175 testmath("Math.atan", "Number.NEGATIVE_INFINITY", -Math.PI/2)
    176 testmath("Math.atan", "1", Math.PI/4)
    177 testmath("Math.atan", "-1", -Math.PI/4)
    178 
    179 testmath("Math.atan2", "Number.NaN,0", Number.NaN)
    180 testmath("Math.atan2", "null, null", 0)
    181 testmath("Math.atan2", "void 0, void 0", Number.NaN)
    182 testmath("Math.atan2", "0,Number.NaN", Number.NaN)
    183 testmath("Math.atan2", "1,0", Math.PI/2)
    184 testmath("Math.atan2", "1,-0", Math.PI/2)
    185 testmath("Math.atan2", "0,0.001", 0)
    186 testmath("Math.atan2", "0,0", 0)
    187 testmath("Math.atan2", "0,-0", Math.PI)
    188 testmath("Math.atan2", "0, -1", Math.PI)
    189 testmath("Math.atan2", "-0, 1", -0)
    190 testmath("Infinity/Math.atan2", "-0,1", -Infinity)
    191 testmath("Math.atan2", "-0,0", -0)
    192 testmath("Math.atan2", "-0, -0", -Math.PI)
    193 testmath("Math.atan2", "-0, -1", -Math.PI)
    194 testmath("Math.atan2", "-1, 0", -Math.PI/2)
    195 testmath("Math.atan2", "-1, -0", -Math.PI/2)
    196 testmath("Math.atan2", "1, Number.POSITIVE_INFINITY", 0)
    197 testmath("Math.atan2", "1, Number.NEGATIVE_INFINITY", Math.PI)
    198 testmath("Math.atan2", "-1,Number.POSITIVE_INFINITY", -0)
    199 testmath("Infinity/Math.atan2", "-1,Infinity", -Infinity)
    200 testmath("Math.atan2", "-1,Number.NEGATIVE_INFINITY", -Math.PI)
    201 testmath("Math.atan2", "Number.POSITIVE_INFINITY, 0", Math.PI/2)
    202 testmath("Math.atan2", "Number.POSITIVE_INFINITY, 1", Math.PI/2)
    203 testmath("Math.atan2", "Number.POSITIVE_INFINITY,-1", Math.PI/2)
    204 testmath("Math.atan2", "Number.POSITIVE_INFINITY,-0", Math.PI/2)
    205 testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 0", -Math.PI/2)
    206 testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-0", -Math.PI/2)
    207 testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 1", -Math.PI/2)
    208 testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-1", -Math.PI/2)
    209 testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY", Math.PI/4)
    210 testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY", 3*Math.PI/4)
    211 testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", -Math.PI/4)
    212 testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", -3*Math.PI/4)
    213 testmath("Math.atan2", "-1, 1", -Math.PI/4)
    214 
    215 testmath("Math.ceil", "Number.NaN", Number.NaN)
    216 testmath("Math.ceil", "null", 0)
    217 testmath("Math.ceil", "void 0", Number.NaN)
    218 testmath("Math.ceil", "'0'", 0)
    219 testmath("Math.ceil", "'-0'", -0)
    220 testmath("Infinity/Math.ceil", "'0'", Infinity)
    221 testmath("Infinity/Math.ceil", "'-0'", -Infinity)
    222 testmath("Math.ceil", "0", 0)
    223 testmath("Math.ceil", "-0", -0)
    224 testmath("Infinity/Math.ceil", "0", Infinity)
    225 testmath("Infinity/Math.ceil", "-0", -Infinity)
    226 testmath("Math.ceil", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    227 testmath("Math.ceil", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
    228 testmath("Math.ceil", "-Number.MIN_VALUE", -0)
    229 testmath("Infinity/Math.ceil", "-Number.MIN_VALUE", -Infinity)
    230 testmath("Math.ceil", "1", 1)
    231 testmath("Math.ceil", "-1", -1)
    232 testmath("Math.ceil", "-0.9", -0)
    233 testmath("Infinity/Math.ceil", "-0.9", -Infinity)
    234 testmath("Math.ceil", "0.9", 1)
    235 testmath("Math.ceil", "-1.1", -1)
    236 testmath("Math.ceil", "1.1", 2)
    237 testmath("Math.ceil", "Number.POSITIVE_INFINITY", -Math.floor(-Infinity))
    238 testmath("Math.ceil", "Number.NEGATIVE_INFINITY", -Math.floor(Infinity))
    239 testmath("Math.ceil", "-Number.MIN_VALUE", -Math.floor(Number.MIN_VALUE))
    240 testmath("Math.ceil", "1", -Math.floor(-1))
    241 testmath("Math.ceil", "-1", -Math.floor(1))
    242 testmath("Math.ceil", "-0.9", -Math.floor(0.9))
    243 testmath("Math.ceil", "0.9", -Math.floor(-0.9))
    244 testmath("Math.ceil", "-1.1", -Math.floor(1.1))
    245 testmath("Math.ceil", "1.1", -Math.floor(-1.1))
    246 
    247 testmath("Math.cos", "void 0", Number.NaN)
    248 testmath("Math.cos", "false", 1)
    249 testmath("Math.cos", "null", 1)
    250 testmath("Math.cos", "'0'", 1)
    251 testmath("Math.cos", "\"Infinity\"", Number.NaN)
    252 testmath("Math.cos", "'3.14159265359'", -1)
    253 testmath("Math.cos", "Number.NaN", Number.NaN)
    254 testmath("Math.cos", "0", 1)
    255 testmath("Math.cos", "-0", 1)
    256 testmath("Math.cos", "Number.POSITIVE_INFINITY", Number.NaN)
    257 testmath("Math.cos", "Number.NEGATIVE_INFINITY", Number.NaN)
    258 testmath("Math.cos", "0.7853981633974", 0.7071067811865)
    259 testmath("Math.cos", "1.570796326795", 0)
    260 testmath("Math.cos", "2.356194490192", -0.7071067811865)
    261 testmath("Math.cos", "3.14159265359", -1)
    262 testmath("Math.cos", "3.926990816987", -0.7071067811865)
    263 testmath("Math.cos", "4.712388980385", 0)
    264 testmath("Math.cos", "5.497787143782", 0.7071067811865)
    265 testmath("Math.cos", "Math.PI*2", 1)
    266 testmath("Math.cos", "Math.PI/4", Math.SQRT2/2)
    267 testmath("Math.cos", "Math.PI/2", 0)
    268 testmath("Math.cos", "3*Math.PI/4", -Math.SQRT2/2)
    269 testmath("Math.cos", "Math.PI", -1)
    270 testmath("Math.cos", "5*Math.PI/4", -Math.SQRT2/2)
    271 testmath("Math.cos", "3*Math.PI/2", 0)
    272 testmath("Math.cos", "7*Math.PI/4", Math.SQRT2/2)
    273 testmath("Math.cos", "2*Math.PI", 1)
    274 testmath("Math.cos", "-0.7853981633974", 0.7071067811865)
    275 testmath("Math.cos", "-1.570796326795", 0)
    276 testmath("Math.cos", "2.3561944901920", -.7071067811865)
    277 testmath("Math.cos", "3.14159265359", -1)
    278 testmath("Math.cos", "3.926990816987", -0.7071067811865)
    279 testmath("Math.cos", "4.712388980385", 0)
    280 testmath("Math.cos", "5.497787143782", 0.7071067811865)
    281 testmath("Math.cos", "6.28318530718", 1)
    282 testmath("Math.cos", "-Math.PI/4", Math.SQRT2/2)
    283 testmath("Math.cos", "-Math.PI/2", 0)
    284 testmath("Math.cos", "-3*Math.PI/4", -Math.SQRT2/2)
    285 testmath("Math.cos", "-Math.PI", -1)
    286 testmath("Math.cos", "-5*Math.PI/4", -Math.SQRT2/2)
    287 testmath("Math.cos", "-3*Math.PI/2", 0)
    288 testmath("Math.cos", "-7*Math.PI/4", Math.SQRT2/2)
    289 testmath("Math.cos", "-Math.PI*2", 1)
    290 
    291 testmath("Math.exp", "null", 1)
    292 testmath("Math.exp", "void 0", Number.NaN)
    293 testmath("Math.exp", "1", Math.E)
    294 testmath("Math.exp", "true", Math.E)
    295 testmath("Math.exp", "false", 1)
    296 testmath("Math.exp", "'1'", Math.E)
    297 testmath("Math.exp", "'0'", 1)
    298 testmath("Math.exp", "Number.NaN", Number.NaN)
    299 testmath("Math.exp", "0", 1)
    300 testmath("Math.exp", "-0", 1)
    301 testmath("Math.exp", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    302 testmath("Math.exp", "Number.NEGATIVE_INFINITY", 0)
    303 
    304 testmath("Math.floor", "void 0", Number.NaN)
    305 testmath("Math.floor", "null", 0)
    306 testmath("Math.floor", "true", 1)
    307 testmath("Math.floor", "false", 0)
    308 testmath("Math.floor", "\"1.1\"", 1)
    309 testmath("Math.floor", "\"-1.1\"", -2)
    310 testmath("Math.floor", "\"0.1\"", 0)
    311 testmath("Math.floor", "\"-0.1\"", -1)
    312 testmath("Math.floor", "Number.NaN", Number.NaN)
    313 testmath("Math.floor(Number.NaN) == -Math.ceil", "-Number.NaN", false)
    314 testmath("Math.floor", "0", 0)
    315 testmath("Math.floor(0) == -Math.ceil", "-0", true)
    316 testmath("Math.floor", "-0", -0)
    317 testmath("Infinity/Math.floor", "-0", -Infinity)
    318 testmath("Math.floor(-0)== -Math.ceil", "0", true)
    319 testmath("Math.floor", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    320 testmath("Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil", "Number.NEGATIVE_INFINITY", true)
    321 testmath("Math.floor", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
    322 testmath("Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil", "Number.POSITIVE_INFINITY", true)
    323 testmath("Math.floor", "0.0000001", 0)
    324 testmath("Math.floor(0.0000001)==-Math.ceil", "-0.0000001", true)
    325 testmath("Math.floor", "-0.0000001", -1)
    326 testmath("Math.floor(-0.0000001)==-Math.ceil", "0.0000001", true)
    327 
    328 testmath("Math.log", "void 0", Number.NaN)
    329 testmath("Math.log", "null", Number.NEGATIVE_INFINITY)
    330 testmath("Math.log", "true", 0)
    331 testmath("Math.log", "false", -Infinity)
    332 testmath("Math.log", "'0'", -Infinity)
    333 testmath("Math.log", "'1'", 0)
    334 testmath("Math.log", "\"Infinity\"", Infinity)
    335 testmath("Math.log", "Number.NaN", Number.NaN)
    336 testmath("Math.log", "-0.000001", Number.NaN)
    337 testmath("Math.log", "-1", Number.NaN)
    338 testmath("Math.log", "0", Number.NEGATIVE_INFINITY)
    339 testmath("Math.log", "-0", Number.NEGATIVE_INFINITY)
    340 testmath("Math.log", "1", 0)
    341 testmath("Math.log", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    342 testmath("Math.log", "Number.NEGATIVE_INFINITY", Number.NaN)
    343 
    344 testmath("Math.max", "void 0, 1", Number.NaN)
    345 testmath("Math.max", "void 0, void 0", Number.NaN)
    346 testmath("Math.max", "null, 1", 1)
    347 testmath("Math.max", "-1, null", 0)
    348 testmath("Math.max", "true,false", 1)
    349 testmath("Math.max", "\"-99\",\"99\"", 99)
    350 testmath("Math.max", "Number.NaN,Number.POSITIVE_INFINITY", Number.NaN)
    351 testmath("Math.max", "Number.NaN, 0", Number.NaN)
    352 testmath("Math.max", "\"a string\", 0", Number.NaN)
    353 testmath("Math.max", "Number.NaN,1", Number.NaN)
    354 testmath("Math.max", "\"a string\", Number.POSITIVE_INFINITY", Number.NaN)
    355 testmath("Math.max", "Number.POSITIVE_INFINITY, Number.NaN", Number.NaN)
    356 testmath("Math.max", "Number.NaN, Number.NaN", Number.NaN)
    357 testmath("Math.max", "0,Number.NaN", Number.NaN)
    358 testmath("Math.max", "1, Number.NaN", Number.NaN)
    359 testmath("Math.max", "0,0", 0)
    360 testmath("Math.max", "0,-0", 0)
    361 testmath("Math.max", "-0,0", 0)
    362 testmath("Math.max", "-0,-0", -0)
    363 testmath("Infinity/Math.max", "-0,-0", -Infinity)
    364 testmath("Math.max", "Number.POSITIVE_INFINITY, Number.MAX_VALUE", Number.POSITIVE_INFINITY)
    365 testmath("Math.max", "Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    366 testmath("Math.max", "Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
    367 testmath("Math.max", "1,.99999999999999", 1)
    368 testmath("Math.max", "-1,-.99999999999999", -.99999999999999)
    369 
    370 testmath("Math.min", "void 0, 1", Number.NaN)
    371 testmath("Math.min", "void 0, void 0", Number.NaN)
    372 testmath("Math.min", "null, 1", 0)
    373 testmath("Math.min", "-1, null", -1)
    374 testmath("Math.min", "true,false", 0)
    375 testmath("Math.min", "\"-99\",\"99\"", -99)
    376 testmath("Math.min", "Number.NaN,0", Number.NaN)
    377 testmath("Math.min", "Number.NaN,1", Number.NaN)
    378 testmath("Math.min", "Number.NaN,-1", Number.NaN)
    379 testmath("Math.min", "0,Number.NaN", Number.NaN)
    380 testmath("Math.min", "1,Number.NaN", Number.NaN)
    381 testmath("Math.min", "-1,Number.NaN", Number.NaN)
    382 testmath("Math.min", "Number.NaN,Number.NaN", Number.NaN)
    383 testmath("Math.min", "1,1.0000000001", 1)
    384 testmath("Math.min", "1.0000000001,1", 1)
    385 testmath("Math.min", "0,0", 0)
    386 testmath("Math.min", "0,-0", -0)
    387 testmath("Math.min", "-0,-0", -0)
    388 testmath("Infinity/Math.min", "0,-0", -Infinity)
    389 testmath("Infinity/Math.min", "-0,-0", -Infinity)
    390 
    391 testmath("Math.pow", "null,null", 1)
    392 testmath("Math.pow", "void 0, void 0", Number.NaN)
    393 testmath("Math.pow", "true, false", 1)
    394 testmath("Math.pow", "false,true", 0)
    395 testmath("Math.pow", "'2','32'", 4294967296)
    396 testmath("Math.pow", "1,Number.NaN", Number.NaN)
    397 testmath("Math.pow", "0,Number.NaN", Number.NaN)
    398 testmath("Math.pow", "Number.NaN,0", 1)
    399 testmath("Math.pow", "Number.NaN,-0", 1)
    400 testmath("Math.pow", "Number.NaN, 1", Number.NaN)
    401 testmath("Math.pow", "Number.NaN, .5", Number.NaN)
    402 testmath("Math.pow", "1.00000001, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    403 testmath("Math.pow", "1.00000001, Number.NEGATIVE_INFINITY", 0)
    404 testmath("Math.pow", "-1.00000001,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    405 testmath("Math.pow", "-1.00000001,Number.NEGATIVE_INFINITY", 0)
    406 testmath("Math.pow", "1, Number.POSITIVE_INFINITY", Number.NaN)
    407 testmath("Math.pow", "1, Number.NEGATIVE_INFINITY", Number.NaN)
    408 testmath("Math.pow", "-1, Number.POSITIVE_INFINITY", Number.NaN)
    409 testmath("Math.pow", "-1, Number.NEGATIVE_INFINITY", Number.NaN)
    410 testmath("Math.pow", ".0000000009, Number.POSITIVE_INFINITY", 0)
    411 testmath("Math.pow", "-.0000000009, Number.POSITIVE_INFINITY", 0)
    412 testmath("Math.pow", "-.0000000009, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
    413 testmath("Math.pow", "Number.POSITIVE_INFINITY,.00000000001", Number.POSITIVE_INFINITY)
    414 testmath("Math.pow", "Number.POSITIVE_INFINITY, 1", Number.POSITIVE_INFINITY)
    415 testmath("Math.pow", "Number.POSITIVE_INFINITY, -.00000000001", 0)
    416 testmath("Math.pow", "Number.POSITIVE_INFINITY, -1", 0)
    417 testmath("Math.pow", "Number.NEGATIVE_INFINITY, 1", Number.NEGATIVE_INFINITY)
    418 testmath("Math.pow", "Number.NEGATIVE_INFINITY, 333", Number.NEGATIVE_INFINITY)
    419 testmath("Math.pow", "Number.POSITIVE_INFINITY, 2", Number.POSITIVE_INFINITY)
    420 testmath("Math.pow", "Number.NEGATIVE_INFINITY, 666", Number.POSITIVE_INFINITY)
    421 testmath("Math.pow", "Number.NEGATIVE_INFINITY, 0.5", Number.POSITIVE_INFINITY)
    422 testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    423 testmath("Math.pow", "Number.NEGATIVE_INFINITY, -1", -0)
    424 testmath("Infinity/Math.pow", "Number.NEGATIVE_INFINITY, -1", -Infinity)
    425 testmath("Math.pow", "Number.NEGATIVE_INFINITY, -3", -0)
    426 testmath("Math.pow", "Number.NEGATIVE_INFINITY, -2", 0)
    427 testmath("Math.pow", "Number.NEGATIVE_INFINITY,-0.5", 0)
    428 testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", 0)
    429 testmath("Math.pow", "0,1", 0)
    430 testmath("Math.pow", "0,0", 1)
    431 testmath("Math.pow", "1,0", 1)
    432 testmath("Math.pow", "-1,0", 1)
    433 testmath("Math.pow", "0,0.5", 0)
    434 testmath("Math.pow", "0,1000", 0)
    435 testmath("Math.pow", "0, Number.POSITIVE_INFINITY", 0)
    436 testmath("Math.pow", "0, -1", Number.POSITIVE_INFINITY)
    437 testmath("Math.pow", "0, -0.5", Number.POSITIVE_INFINITY)
    438 testmath("Math.pow", "0, -1000", Number.POSITIVE_INFINITY)
    439 testmath("Math.pow", "0, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY)
    440 testmath("Math.pow", "-0, 1", -0)
    441 testmath("Math.pow", "-0,3", -0)
    442 testmath("Infinity/Math.pow", "-0, 1", -Infinity)
    443 testmath("Infinity/Math.pow", "-0,3", -Infinity)
    444 testmath("Math.pow", "-0,2", 0)
    445 testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0)
    446 testmath("Math.pow", "-0, -1", Number.NEGATIVE_INFINITY)
    447 testmath("Math.pow", "-0, -10001", Number.NEGATIVE_INFINITY)
    448 testmath("Math.pow", "-0, -2", Number.POSITIVE_INFINITY)
    449 testmath("Math.pow", "-0, 0.5", 0)
    450 testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0)
    451 testmath("Math.pow", "-1, 0.5", Number.NaN)
    452 testmath("Math.pow", "-1, Number.NaN", Number.NaN)
    453 testmath("Math.pow", "-1, -0.5", Number.NaN)
    454 
    455 testmath("Math.round", "0", 0)
    456 testmath("Math.round", "void 0", Number.NaN)
    457 testmath("Math.round", "true", 1)
    458 testmath("Math.round", "false", 0)
    459 testmath("Math.round", "'.99999'", 1)
    460 testmath("Math.round", "'12345e-2'", 123)
    461 testmath("Math.round", "Number.NaN", Number.NaN)
    462 testmath("Math.round", "0", 0)
    463 testmath("Math.round", "-0", -0)
    464 testmath("Infinity/Math.round", "-0", -Infinity)
    465 testmath("Math.round", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    466 testmath("Math.round", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY)
    467 testmath("Math.round", "0.49", 0)
    468 testmath("Math.round", "0.5", 1)
    469 testmath("Math.round", "0.51", 1)
    470 testmath("Math.round", "-0.49", -0)
    471 testmath("Math.round", "-0.5", -0)
    472 testmath("Infinity/Math.round", "-0.49", -Infinity)
    473 testmath("Infinity/Math.round", "-0.5", -Infinity)
    474 testmath("Math.round", "-0.51", -1)
    475 testmath("Math.round", "3.5", 4)
    476 testmath("Math.round", "-3", -3)
    477 
    478 testmath("Math.sin", "null", 0)
    479 testmath("Math.sin", "void 0", Number.NaN)
    480 testmath("Math.sin", "false", 0)
    481 testmath("Math.sin", "'2.356194490192'", 0.7071067811865)
    482 testmath("Math.sin", "Number.NaN", Number.NaN)
    483 testmath("Math.sin", "0", 0)
    484 testmath("Math.sin", "-0", -0)
    485 testmath("Math.sin", "Number.POSITIVE_INFINITY", Number.NaN)
    486 testmath("Math.sin", "Number.NEGATIVE_INFINITY", Number.NaN)
    487 testmath("Math.sin", "0.7853981633974", 0.7071067811865)
    488 testmath("Math.sin", "1.570796326795", 1)
    489 testmath("Math.sin", "2.356194490192", 0.7071067811865)
    490 testmath("Math.sin", "3.14159265359", 0)
    491 
    492 testmath("Math.sqrt", "void 0", Number.NaN)
    493 testmath("Math.sqrt", "null", 0)
    494 testmath("Math.sqrt", "1", 1)
    495 testmath("Math.sqrt", "false", 0)
    496 testmath("Math.sqrt", "'225'", 15)
    497 testmath("Math.sqrt", "Number.NaN", Number.NaN)
    498 testmath("Math.sqrt", "Number.NEGATIVE_INFINITY", Number.NaN)
    499 testmath("Math.sqrt", "-1", Number.NaN)
    500 testmath("Math.sqrt", "-0.5", Number.NaN)
    501 testmath("Math.sqrt", "0", 0)
    502 testmath("Math.sqrt", "-0", -0)
    503 testmath("Infinity/Math.sqrt", "-0", -Infinity)
    504 testmath("Math.sqrt", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY)
    505 testmath("Math.sqrt", "1", 1)
    506 testmath("Math.sqrt", "2", Math.SQRT2)
    507 testmath("Math.sqrt", "0.5", Math.SQRT1_2)
    508 testmath("Math.sqrt", "4", 2)
    509 testmath("Math.sqrt", "9", 3)
    510 testmath("Math.sqrt", "16", 4)
    511 testmath("Math.sqrt", "25", 5)
    512 testmath("Math.sqrt", "36", 6)
    513 testmath("Math.sqrt", "49", 7)
    514 testmath("Math.sqrt", "64", 8)
    515 testmath("Math.sqrt", "256", 16)
    516 testmath("Math.sqrt", "10000", 100)
    517 testmath("Math.sqrt", "65536", 256)
    518 testmath("Math.sqrt", "0.09", 0.3)
    519 testmath("Math.sqrt", "0.01", 0.1)
    520 testmath("Math.sqrt", "0.00000001", 0.0001)
    521 
    522 testmath("Math.tan", "void 0", Number.NaN)
    523 testmath("Math.tan", "null", 0)
    524 testmath("Math.tan", "false", 0)
    525 testmath("Math.tan", "Number.NaN", Number.NaN)
    526 testmath("Math.tan", "0", 0)
    527 testmath("Math.tan", "-0", -0)
    528 testmath("Math.tan", "Number.POSITIVE_INFINITY", Number.NaN)
    529 testmath("Math.tan", "Number.NEGATIVE_INFINITY", Number.NaN)
    530 testmath("Math.tan", "Math.PI/4", 1)
    531 testmath("Math.tan", "3*Math.PI/4", -1)
    532 testmath("Math.tan", "Math.PI", -0)
    533 testmath("Math.tan", "5*Math.PI/4", 1)
    534 testmath("Math.tan", "7*Math.PI/4", -1)
    535 testmath("Infinity/Math.tan", "-0", -Infinity)