Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | //----------------------------------------------------------------------------- |
michael@0 | 7 | var BUGNUMBER = 'none'; |
michael@0 | 8 | var summary = 'trace-capability math mini-testsuite'; |
michael@0 | 9 | |
michael@0 | 10 | printBugNumber(BUGNUMBER); |
michael@0 | 11 | printStatus (summary); |
michael@0 | 12 | |
michael@0 | 13 | jit(true); |
michael@0 | 14 | |
michael@0 | 15 | /** |
michael@0 | 16 | * A number of the tests in this file depend on the setting of |
michael@0 | 17 | * HOTLOOP. Define some constants up front, so they're easy to grep |
michael@0 | 18 | * for. |
michael@0 | 19 | */ |
michael@0 | 20 | // The HOTLOOP constant we depend on; only readable from our stats |
michael@0 | 21 | // object in debug builds. |
michael@0 | 22 | const haveTracemonkey = !!(this.tracemonkey) |
michael@0 | 23 | const HOTLOOP = haveTracemonkey ? tracemonkey.HOTLOOP : 2; |
michael@0 | 24 | |
michael@0 | 25 | var testName = null; |
michael@0 | 26 | if ("arguments" in this && arguments.length > 0) |
michael@0 | 27 | testName = arguments[0]; |
michael@0 | 28 | var fails = [], passes=[]; |
michael@0 | 29 | |
michael@0 | 30 | function jitstatHandler(f) |
michael@0 | 31 | { |
michael@0 | 32 | if (!haveTracemonkey) |
michael@0 | 33 | return; |
michael@0 | 34 | |
michael@0 | 35 | // XXXbz this is a nasty hack, but I can't figure out a way to |
michael@0 | 36 | // just use jitstats.tbl here |
michael@0 | 37 | f("recorderStarted"); |
michael@0 | 38 | f("recorderAborted"); |
michael@0 | 39 | f("traceCompleted"); |
michael@0 | 40 | f("sideExitIntoInterpreter"); |
michael@0 | 41 | f("typeMapMismatchAtEntry"); |
michael@0 | 42 | f("returnToDifferentLoopHeader"); |
michael@0 | 43 | f("traceTriggered"); |
michael@0 | 44 | f("globalShapeMismatchAtEntry"); |
michael@0 | 45 | f("treesTrashed"); |
michael@0 | 46 | f("slotPromoted"); |
michael@0 | 47 | f("unstableLoopVariable"); |
michael@0 | 48 | f("noCompatInnerTrees"); |
michael@0 | 49 | f("breakLoopExits"); |
michael@0 | 50 | f("returnLoopExits"); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | function test(f) |
michael@0 | 54 | { |
michael@0 | 55 | if (!testName || testName == f.name) { |
michael@0 | 56 | // Collect our jit stats |
michael@0 | 57 | var localJITstats = {}; |
michael@0 | 58 | jitstatHandler(function(prop, local, global) { |
michael@0 | 59 | localJITstats[prop] = tracemonkey[prop]; |
michael@0 | 60 | }); |
michael@0 | 61 | check(f.name, f(), f.expected, localJITstats, f.jitstats); |
michael@0 | 62 | } |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | function map_test(t, cases) |
michael@0 | 66 | { |
michael@0 | 67 | for (var i = 0; i < cases.length; i++) { |
michael@0 | 68 | function c() { return t(cases[i].input); } |
michael@0 | 69 | c.expected = cases[i].expected; |
michael@0 | 70 | c.name = t.name + "(" + uneval(cases[i].input) + ")"; |
michael@0 | 71 | test(c); |
michael@0 | 72 | } |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | // Use this function to compare expected and actual test results. |
michael@0 | 76 | // Types must match. |
michael@0 | 77 | // For numbers, treat NaN as matching NaN, distinguish 0 and -0, and |
michael@0 | 78 | // tolerate a certain degree of error for other values. |
michael@0 | 79 | // |
michael@0 | 80 | // These are the same criteria used by the tests in js/tests, except that |
michael@0 | 81 | // we distinguish 0 and -0. |
michael@0 | 82 | function close_enough(expected, actual) |
michael@0 | 83 | { |
michael@0 | 84 | if (typeof expected != typeof actual) |
michael@0 | 85 | return false; |
michael@0 | 86 | if (typeof expected != 'number') |
michael@0 | 87 | return actual == expected; |
michael@0 | 88 | |
michael@0 | 89 | // Distinguish NaN from other values. Using x != x comparisons here |
michael@0 | 90 | // works even if tests redefine isNaN. |
michael@0 | 91 | if (actual != actual) |
michael@0 | 92 | return expected != expected |
michael@0 | 93 | if (expected != expected) |
michael@0 | 94 | return false; |
michael@0 | 95 | |
michael@0 | 96 | // Tolerate a certain degree of error. |
michael@0 | 97 | if (actual != expected) |
michael@0 | 98 | return Math.abs(actual - expected) <= 1E-10; |
michael@0 | 99 | |
michael@0 | 100 | // Distinguish 0 and -0. |
michael@0 | 101 | if (actual == 0) |
michael@0 | 102 | return (1 / actual > 0) == (1 / expected > 0); |
michael@0 | 103 | |
michael@0 | 104 | return true; |
michael@0 | 105 | } |
michael@0 | 106 | |
michael@0 | 107 | function check(desc, actual, expected, oldJITstats, expectedJITstats) |
michael@0 | 108 | { |
michael@0 | 109 | var pass = false; |
michael@0 | 110 | if (close_enough(expected, actual)) { |
michael@0 | 111 | pass = true; |
michael@0 | 112 | jitstatHandler(function(prop) { |
michael@0 | 113 | if (expectedJITstats && prop in expectedJITstats && |
michael@0 | 114 | expectedJITstats[prop] != |
michael@0 | 115 | tracemonkey[prop] - oldJITstats[prop]) { |
michael@0 | 116 | pass = false; |
michael@0 | 117 | } |
michael@0 | 118 | }); |
michael@0 | 119 | if (pass) { |
michael@0 | 120 | reportCompare(expected, actual, desc); |
michael@0 | 121 | passes.push(desc); |
michael@0 | 122 | return print(desc, ": passed"); |
michael@0 | 123 | } |
michael@0 | 124 | } |
michael@0 | 125 | |
michael@0 | 126 | if (expected instanceof RegExp) { |
michael@0 | 127 | pass = reportMatch(expected, actual + '', desc); |
michael@0 | 128 | if (pass) { |
michael@0 | 129 | jitstatHandler(function(prop) { |
michael@0 | 130 | if (expectedJITstats && prop in expectedJITstats && |
michael@0 | 131 | expectedJITstats[prop] != |
michael@0 | 132 | tracemonkey[prop] - oldJITstats[prop]) { |
michael@0 | 133 | pass = false; |
michael@0 | 134 | } |
michael@0 | 135 | }); |
michael@0 | 136 | } |
michael@0 | 137 | if (pass) { |
michael@0 | 138 | passes.push(desc); |
michael@0 | 139 | return print(desc, ": passed"); |
michael@0 | 140 | } |
michael@0 | 141 | } |
michael@0 | 142 | |
michael@0 | 143 | reportCompare(expected, actual, desc); |
michael@0 | 144 | |
michael@0 | 145 | fails.push(desc); |
michael@0 | 146 | var expectedStats = ""; |
michael@0 | 147 | if (expectedJITstats) { |
michael@0 | 148 | jitstatHandler(function(prop) { |
michael@0 | 149 | if (prop in expectedJITstats) { |
michael@0 | 150 | if (expectedStats) |
michael@0 | 151 | expectedStats += " "; |
michael@0 | 152 | expectedStats += |
michael@0 | 153 | prop + ": " + expectedJITstats[prop]; |
michael@0 | 154 | } |
michael@0 | 155 | }); |
michael@0 | 156 | } |
michael@0 | 157 | var actualStats = ""; |
michael@0 | 158 | if (expectedJITstats) { |
michael@0 | 159 | jitstatHandler(function(prop) { |
michael@0 | 160 | if (prop in expectedJITstats) { |
michael@0 | 161 | if (actualStats) |
michael@0 | 162 | actualStats += " "; |
michael@0 | 163 | actualStats += prop + ": " + (tracemonkey[prop]-oldJITstats[prop]); |
michael@0 | 164 | } |
michael@0 | 165 | }); |
michael@0 | 166 | } |
michael@0 | 167 | print(desc, ": FAILED: expected", typeof(expected), |
michael@0 | 168 | "(", uneval(expected), ")", |
michael@0 | 169 | (expectedStats ? " [" + expectedStats + "] " : ""), |
michael@0 | 170 | "!= actual", |
michael@0 | 171 | typeof(actual), "(", uneval(actual), ")", |
michael@0 | 172 | (actualStats ? " [" + actualStats + "] " : "")); |
michael@0 | 173 | } |
michael@0 | 174 | |
michael@0 | 175 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 176 | |
michael@0 | 177 | // Apply FUNCNAME to ARGS, and check against EXPECTED. |
michael@0 | 178 | // Expect a loop containing such a call to be traced. |
michael@0 | 179 | // FUNCNAME and ARGS are both strings. |
michael@0 | 180 | // ARGS has the form of an argument list: a comma-separated list of expressions. |
michael@0 | 181 | // Certain Tracemonkey limitations require us to pass FUNCNAME as a string. |
michael@0 | 182 | // Passing ARGS as a string allows us to assign better test names: |
michael@0 | 183 | // expressions like Math.PI/4 haven't been evaluated to big hairy numbers. |
michael@0 | 184 | function testmath(funcname, args, expected) { |
michael@0 | 185 | var i, j; |
michael@0 | 186 | |
michael@0 | 187 | var arg_value_list = eval("[" + args + "]"); |
michael@0 | 188 | var arity = arg_value_list.length; |
michael@0 | 189 | |
michael@0 | 190 | // Build the string "a[i][0],...,a[i][ARITY-1]". |
michael@0 | 191 | var actuals = [] |
michael@0 | 192 | for (i = 0; i < arity; i++) |
michael@0 | 193 | actuals.push("a[i][" + i + "]"); |
michael@0 | 194 | actuals = actuals.join(","); |
michael@0 | 195 | |
michael@0 | 196 | // Create a function that maps FUNCNAME across an array of input values. |
michael@0 | 197 | // Unless we eval here, the call to funcname won't get traced. |
michael@0 | 198 | // FUNCNAME="Infinity/Math.abs" and cases like that happen to |
michael@0 | 199 | // parse, too, in a twisted way. |
michael@0 | 200 | var mapfunc = eval("(function(a) {\n" |
michael@0 | 201 | + " for (var i = 0; i < a.length; i++)\n" |
michael@0 | 202 | + " a[i] = " + funcname + "(" + actuals +");\n" |
michael@0 | 203 | + " })\n"); |
michael@0 | 204 | |
michael@0 | 205 | // To prevent the compiler from doing constant folding, produce an |
michael@0 | 206 | // array to pass to mapfunc that contains enough dummy |
michael@0 | 207 | // values at the front to get the loop body jitted, and then our |
michael@0 | 208 | // actual test value. |
michael@0 | 209 | var dummies_and_input = []; |
michael@0 | 210 | for (i = 0; i < RUNLOOP; i++) { |
michael@0 | 211 | var dummy_list = []; |
michael@0 | 212 | for (j = 0; j < arity; j++) |
michael@0 | 213 | dummy_list[j] = .0078125 * ((i + j) % 128); |
michael@0 | 214 | dummies_and_input[i] = dummy_list; |
michael@0 | 215 | } |
michael@0 | 216 | dummies_and_input[RUNLOOP] = arg_value_list; |
michael@0 | 217 | |
michael@0 | 218 | function testfunc() { |
michael@0 | 219 | // Map the function across the dummy values and the test input. |
michael@0 | 220 | mapfunc(dummies_and_input); |
michael@0 | 221 | return dummies_and_input[RUNLOOP]; |
michael@0 | 222 | } |
michael@0 | 223 | testfunc.name = funcname + "(" + args + ")"; |
michael@0 | 224 | testfunc.expected = expected; |
michael@0 | 225 | |
michael@0 | 226 | // Disable jitstats check. This never worked right. The actual part of the |
michael@0 | 227 | // loop we cared about was never traced. We traced the filler parts early |
michael@0 | 228 | // and then took a mismatch side exit on every subequent array read with |
michael@0 | 229 | // a different type (gal, discovered when fixing bug 479110). |
michael@0 | 230 | // testfunc.jitstats = { |
michael@0 | 231 | // recorderStarted: 1, |
michael@0 | 232 | // recorderAborted: 0, |
michael@0 | 233 | // traceTriggered: 1 |
michael@0 | 234 | // }; |
michael@0 | 235 | |
michael@0 | 236 | test(testfunc); |
michael@0 | 237 | } |
michael@0 | 238 | |
michael@0 | 239 | testmath("Math.abs", "void 0", Number.NaN) |
michael@0 | 240 | testmath("Math.abs", "null", 0) |
michael@0 | 241 | testmath("Math.abs", "true", 1) |
michael@0 | 242 | testmath("Math.abs", "false", 0) |
michael@0 | 243 | testmath("Math.abs", "\"a string primitive\"", Number.NaN) |
michael@0 | 244 | testmath("Math.abs", "new String( 'a String object' )", Number.NaN) |
michael@0 | 245 | testmath("Math.abs", "Number.NaN", Number.NaN) |
michael@0 | 246 | testmath("Math.abs", "0", 0) |
michael@0 | 247 | testmath("Math.abs", "-0", 0) |
michael@0 | 248 | testmath("Infinity/Math.abs", "-0", Infinity) |
michael@0 | 249 | testmath("Math.abs", "Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 250 | testmath("Math.abs", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 251 | testmath("Math.abs", "- Number.MAX_VALUE", Number.MAX_VALUE) |
michael@0 | 252 | testmath("Math.abs", "-Number.MIN_VALUE", Number.MIN_VALUE) |
michael@0 | 253 | testmath("Math.abs", "Number.MAX_VALUE", Number.MAX_VALUE) |
michael@0 | 254 | testmath("Math.abs", "Number.MIN_VALUE", Number.MIN_VALUE) |
michael@0 | 255 | testmath("Math.abs", "-1", 1) |
michael@0 | 256 | testmath("Math.abs", "new Number(-1)", 1) |
michael@0 | 257 | testmath("Math.abs", "1", 1) |
michael@0 | 258 | testmath("Math.abs", "Math.PI", Math.PI) |
michael@0 | 259 | testmath("Math.abs", "-Math.PI", Math.PI) |
michael@0 | 260 | testmath("Math.abs", "-1/100000000", 1/100000000) |
michael@0 | 261 | testmath("Math.abs", "-Math.pow(2,32)", Math.pow(2,32)) |
michael@0 | 262 | testmath("Math.abs", "Math.pow(2,32)", Math.pow(2,32)) |
michael@0 | 263 | testmath("Math.abs", "-0xfff", 4095) |
michael@0 | 264 | testmath("Math.abs", "-0777", 511) |
michael@0 | 265 | testmath("Math.abs", "'-1e-1'", 0.1) |
michael@0 | 266 | testmath("Math.abs", "'0xff'", 255) |
michael@0 | 267 | testmath("Math.abs", "'077'", 77) |
michael@0 | 268 | testmath("Math.abs", "'Infinity'", Infinity) |
michael@0 | 269 | testmath("Math.abs", "'-Infinity'", Infinity) |
michael@0 | 270 | |
michael@0 | 271 | testmath("Math.acos", "void 0", Number.NaN) |
michael@0 | 272 | testmath("Math.acos", "null", Math.PI/2) |
michael@0 | 273 | testmath("Math.acos", "Number.NaN", Number.NaN) |
michael@0 | 274 | testmath("Math.acos", "\"a string\"", Number.NaN) |
michael@0 | 275 | testmath("Math.acos", "'0'", Math.PI/2) |
michael@0 | 276 | testmath("Math.acos", "'1'", 0) |
michael@0 | 277 | testmath("Math.acos", "'-1'", Math.PI) |
michael@0 | 278 | testmath("Math.acos", "1.00000001", Number.NaN) |
michael@0 | 279 | testmath("Math.acos", "-1.00000001", Number.NaN) |
michael@0 | 280 | testmath("Math.acos", "1", 0) |
michael@0 | 281 | testmath("Math.acos", "-1", Math.PI) |
michael@0 | 282 | testmath("Math.acos", "0", Math.PI/2) |
michael@0 | 283 | testmath("Math.acos", "-0", Math.PI/2) |
michael@0 | 284 | testmath("Math.acos", "Math.SQRT1_2", Math.PI/4) |
michael@0 | 285 | testmath("Math.acos", "-Math.SQRT1_2", Math.PI/4*3) |
michael@0 | 286 | testmath("Math.acos", "0.9999619230642", Math.PI/360) |
michael@0 | 287 | testmath("Math.acos", "-3.0", Number.NaN) |
michael@0 | 288 | |
michael@0 | 289 | testmath("Math.asin", "void 0", Number.NaN) |
michael@0 | 290 | testmath("Math.asin", "null", 0) |
michael@0 | 291 | testmath("Math.asin", "Number.NaN", Number.NaN) |
michael@0 | 292 | testmath("Math.asin", "\"string\"", Number.NaN) |
michael@0 | 293 | testmath("Math.asin", "\"0\"", 0) |
michael@0 | 294 | testmath("Math.asin", "\"1\"", Math.PI/2) |
michael@0 | 295 | testmath("Math.asin", "\"-1\"", -Math.PI/2) |
michael@0 | 296 | testmath("Math.asin", "Math.SQRT1_2+''", Math.PI/4) |
michael@0 | 297 | testmath("Math.asin", "-Math.SQRT1_2+''", -Math.PI/4) |
michael@0 | 298 | testmath("Math.asin", "1.000001", Number.NaN) |
michael@0 | 299 | testmath("Math.asin", "-1.000001", Number.NaN) |
michael@0 | 300 | testmath("Math.asin", "0", 0) |
michael@0 | 301 | testmath("Math.asin", "-0", -0) |
michael@0 | 302 | testmath("Infinity/Math.asin", "-0", -Infinity) |
michael@0 | 303 | testmath("Math.asin", "1", Math.PI/2) |
michael@0 | 304 | testmath("Math.asin", "-1", -Math.PI/2) |
michael@0 | 305 | testmath("Math.asin", "Math.SQRT1_2", Math.PI/4) |
michael@0 | 306 | testmath("Math.asin", "-Math.SQRT1_2", -Math.PI/4) |
michael@0 | 307 | |
michael@0 | 308 | testmath("Math.atan", "void 0", Number.NaN) |
michael@0 | 309 | testmath("Math.atan", "null", 0) |
michael@0 | 310 | testmath("Math.atan", "Number.NaN", Number.NaN) |
michael@0 | 311 | testmath("Math.atan", "\"a string\"", Number.NaN) |
michael@0 | 312 | testmath("Math.atan", "'0'", 0) |
michael@0 | 313 | testmath("Math.atan", "'1'", Math.PI/4) |
michael@0 | 314 | testmath("Math.atan", "'-1'", -Math.PI/4) |
michael@0 | 315 | testmath("Math.atan", "'Infinity'", Math.PI/2) |
michael@0 | 316 | testmath("Math.atan", "'-Infinity'", -Math.PI/2) |
michael@0 | 317 | testmath("Math.atan", "0", 0) |
michael@0 | 318 | testmath("Math.atan", "-0", -0) |
michael@0 | 319 | testmath("Infinity/Math.atan", "-0", -Infinity) |
michael@0 | 320 | testmath("Math.atan", "Number.POSITIVE_INFINITY", Math.PI/2) |
michael@0 | 321 | testmath("Math.atan", "Number.NEGATIVE_INFINITY", -Math.PI/2) |
michael@0 | 322 | testmath("Math.atan", "1", Math.PI/4) |
michael@0 | 323 | testmath("Math.atan", "-1", -Math.PI/4) |
michael@0 | 324 | |
michael@0 | 325 | testmath("Math.atan2", "Number.NaN,0", Number.NaN) |
michael@0 | 326 | testmath("Math.atan2", "null, null", 0) |
michael@0 | 327 | testmath("Math.atan2", "void 0, void 0", Number.NaN) |
michael@0 | 328 | testmath("Math.atan2", "0,Number.NaN", Number.NaN) |
michael@0 | 329 | testmath("Math.atan2", "1,0", Math.PI/2) |
michael@0 | 330 | testmath("Math.atan2", "1,-0", Math.PI/2) |
michael@0 | 331 | testmath("Math.atan2", "0,0.001", 0) |
michael@0 | 332 | testmath("Math.atan2", "0,0", 0) |
michael@0 | 333 | testmath("Math.atan2", "0,-0", Math.PI) |
michael@0 | 334 | testmath("Math.atan2", "0, -1", Math.PI) |
michael@0 | 335 | testmath("Math.atan2", "-0, 1", -0) |
michael@0 | 336 | testmath("Infinity/Math.atan2", "-0,1", -Infinity) |
michael@0 | 337 | testmath("Math.atan2", "-0,0", -0) |
michael@0 | 338 | testmath("Math.atan2", "-0, -0", -Math.PI) |
michael@0 | 339 | testmath("Math.atan2", "-0, -1", -Math.PI) |
michael@0 | 340 | testmath("Math.atan2", "-1, 0", -Math.PI/2) |
michael@0 | 341 | testmath("Math.atan2", "-1, -0", -Math.PI/2) |
michael@0 | 342 | testmath("Math.atan2", "1, Number.POSITIVE_INFINITY", 0) |
michael@0 | 343 | testmath("Math.atan2", "1, Number.NEGATIVE_INFINITY", Math.PI) |
michael@0 | 344 | testmath("Math.atan2", "-1,Number.POSITIVE_INFINITY", -0) |
michael@0 | 345 | testmath("Infinity/Math.atan2", "-1,Infinity", -Infinity) |
michael@0 | 346 | testmath("Math.atan2", "-1,Number.NEGATIVE_INFINITY", -Math.PI) |
michael@0 | 347 | testmath("Math.atan2", "Number.POSITIVE_INFINITY, 0", Math.PI/2) |
michael@0 | 348 | testmath("Math.atan2", "Number.POSITIVE_INFINITY, 1", Math.PI/2) |
michael@0 | 349 | testmath("Math.atan2", "Number.POSITIVE_INFINITY,-1", Math.PI/2) |
michael@0 | 350 | testmath("Math.atan2", "Number.POSITIVE_INFINITY,-0", Math.PI/2) |
michael@0 | 351 | testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 0", -Math.PI/2) |
michael@0 | 352 | testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-0", -Math.PI/2) |
michael@0 | 353 | testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 1", -Math.PI/2) |
michael@0 | 354 | testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-1", -Math.PI/2) |
michael@0 | 355 | testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY", Math.PI/4) |
michael@0 | 356 | testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY", 3*Math.PI/4) |
michael@0 | 357 | testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", -Math.PI/4) |
michael@0 | 358 | testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", -3*Math.PI/4) |
michael@0 | 359 | testmath("Math.atan2", "-1, 1", -Math.PI/4) |
michael@0 | 360 | |
michael@0 | 361 | testmath("Math.ceil", "Number.NaN", Number.NaN) |
michael@0 | 362 | testmath("Math.ceil", "null", 0) |
michael@0 | 363 | testmath("Math.ceil", "void 0", Number.NaN) |
michael@0 | 364 | testmath("Math.ceil", "'0'", 0) |
michael@0 | 365 | testmath("Math.ceil", "'-0'", -0) |
michael@0 | 366 | testmath("Infinity/Math.ceil", "'0'", Infinity) |
michael@0 | 367 | testmath("Infinity/Math.ceil", "'-0'", -Infinity) |
michael@0 | 368 | testmath("Math.ceil", "0", 0) |
michael@0 | 369 | testmath("Math.ceil", "-0", -0) |
michael@0 | 370 | testmath("Infinity/Math.ceil", "0", Infinity) |
michael@0 | 371 | testmath("Infinity/Math.ceil", "-0", -Infinity) |
michael@0 | 372 | testmath("Math.ceil", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 373 | testmath("Math.ceil", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) |
michael@0 | 374 | testmath("Math.ceil", "-Number.MIN_VALUE", -0) |
michael@0 | 375 | testmath("Infinity/Math.ceil", "-Number.MIN_VALUE", -Infinity) |
michael@0 | 376 | testmath("Math.ceil", "1", 1) |
michael@0 | 377 | testmath("Math.ceil", "-1", -1) |
michael@0 | 378 | testmath("Math.ceil", "-0.9", -0) |
michael@0 | 379 | testmath("Infinity/Math.ceil", "-0.9", -Infinity) |
michael@0 | 380 | testmath("Math.ceil", "0.9", 1) |
michael@0 | 381 | testmath("Math.ceil", "-1.1", -1) |
michael@0 | 382 | testmath("Math.ceil", "1.1", 2) |
michael@0 | 383 | testmath("Math.ceil", "Number.POSITIVE_INFINITY", -Math.floor(-Infinity)) |
michael@0 | 384 | testmath("Math.ceil", "Number.NEGATIVE_INFINITY", -Math.floor(Infinity)) |
michael@0 | 385 | testmath("Math.ceil", "-Number.MIN_VALUE", -Math.floor(Number.MIN_VALUE)) |
michael@0 | 386 | testmath("Math.ceil", "1", -Math.floor(-1)) |
michael@0 | 387 | testmath("Math.ceil", "-1", -Math.floor(1)) |
michael@0 | 388 | testmath("Math.ceil", "-0.9", -Math.floor(0.9)) |
michael@0 | 389 | testmath("Math.ceil", "0.9", -Math.floor(-0.9)) |
michael@0 | 390 | testmath("Math.ceil", "-1.1", -Math.floor(1.1)) |
michael@0 | 391 | testmath("Math.ceil", "1.1", -Math.floor(-1.1)) |
michael@0 | 392 | |
michael@0 | 393 | testmath("Math.cos", "void 0", Number.NaN) |
michael@0 | 394 | testmath("Math.cos", "false", 1) |
michael@0 | 395 | testmath("Math.cos", "null", 1) |
michael@0 | 396 | testmath("Math.cos", "'0'", 1) |
michael@0 | 397 | testmath("Math.cos", "\"Infinity\"", Number.NaN) |
michael@0 | 398 | testmath("Math.cos", "'3.14159265359'", -1) |
michael@0 | 399 | testmath("Math.cos", "Number.NaN", Number.NaN) |
michael@0 | 400 | testmath("Math.cos", "0", 1) |
michael@0 | 401 | testmath("Math.cos", "-0", 1) |
michael@0 | 402 | testmath("Math.cos", "Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 403 | testmath("Math.cos", "Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 404 | testmath("Math.cos", "0.7853981633974", 0.7071067811865) |
michael@0 | 405 | testmath("Math.cos", "1.570796326795", 0) |
michael@0 | 406 | testmath("Math.cos", "2.356194490192", -0.7071067811865) |
michael@0 | 407 | testmath("Math.cos", "3.14159265359", -1) |
michael@0 | 408 | testmath("Math.cos", "3.926990816987", -0.7071067811865) |
michael@0 | 409 | testmath("Math.cos", "4.712388980385", 0) |
michael@0 | 410 | testmath("Math.cos", "5.497787143782", 0.7071067811865) |
michael@0 | 411 | testmath("Math.cos", "Math.PI*2", 1) |
michael@0 | 412 | testmath("Math.cos", "Math.PI/4", Math.SQRT2/2) |
michael@0 | 413 | testmath("Math.cos", "Math.PI/2", 0) |
michael@0 | 414 | testmath("Math.cos", "3*Math.PI/4", -Math.SQRT2/2) |
michael@0 | 415 | testmath("Math.cos", "Math.PI", -1) |
michael@0 | 416 | testmath("Math.cos", "5*Math.PI/4", -Math.SQRT2/2) |
michael@0 | 417 | testmath("Math.cos", "3*Math.PI/2", 0) |
michael@0 | 418 | testmath("Math.cos", "7*Math.PI/4", Math.SQRT2/2) |
michael@0 | 419 | testmath("Math.cos", "2*Math.PI", 1) |
michael@0 | 420 | testmath("Math.cos", "-0.7853981633974", 0.7071067811865) |
michael@0 | 421 | testmath("Math.cos", "-1.570796326795", 0) |
michael@0 | 422 | testmath("Math.cos", "2.3561944901920", -.7071067811865) |
michael@0 | 423 | testmath("Math.cos", "3.14159265359", -1) |
michael@0 | 424 | testmath("Math.cos", "3.926990816987", -0.7071067811865) |
michael@0 | 425 | testmath("Math.cos", "4.712388980385", 0) |
michael@0 | 426 | testmath("Math.cos", "5.497787143782", 0.7071067811865) |
michael@0 | 427 | testmath("Math.cos", "6.28318530718", 1) |
michael@0 | 428 | testmath("Math.cos", "-Math.PI/4", Math.SQRT2/2) |
michael@0 | 429 | testmath("Math.cos", "-Math.PI/2", 0) |
michael@0 | 430 | testmath("Math.cos", "-3*Math.PI/4", -Math.SQRT2/2) |
michael@0 | 431 | testmath("Math.cos", "-Math.PI", -1) |
michael@0 | 432 | testmath("Math.cos", "-5*Math.PI/4", -Math.SQRT2/2) |
michael@0 | 433 | testmath("Math.cos", "-3*Math.PI/2", 0) |
michael@0 | 434 | testmath("Math.cos", "-7*Math.PI/4", Math.SQRT2/2) |
michael@0 | 435 | testmath("Math.cos", "-Math.PI*2", 1) |
michael@0 | 436 | |
michael@0 | 437 | testmath("Math.exp", "null", 1) |
michael@0 | 438 | testmath("Math.exp", "void 0", Number.NaN) |
michael@0 | 439 | testmath("Math.exp", "1", Math.E) |
michael@0 | 440 | testmath("Math.exp", "true", Math.E) |
michael@0 | 441 | testmath("Math.exp", "false", 1) |
michael@0 | 442 | testmath("Math.exp", "'1'", Math.E) |
michael@0 | 443 | testmath("Math.exp", "'0'", 1) |
michael@0 | 444 | testmath("Math.exp", "Number.NaN", Number.NaN) |
michael@0 | 445 | testmath("Math.exp", "0", 1) |
michael@0 | 446 | testmath("Math.exp", "-0", 1) |
michael@0 | 447 | testmath("Math.exp", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 448 | testmath("Math.exp", "Number.NEGATIVE_INFINITY", 0) |
michael@0 | 449 | |
michael@0 | 450 | testmath("Math.floor", "void 0", Number.NaN) |
michael@0 | 451 | testmath("Math.floor", "null", 0) |
michael@0 | 452 | testmath("Math.floor", "true", 1) |
michael@0 | 453 | testmath("Math.floor", "false", 0) |
michael@0 | 454 | testmath("Math.floor", "\"1.1\"", 1) |
michael@0 | 455 | testmath("Math.floor", "\"-1.1\"", -2) |
michael@0 | 456 | testmath("Math.floor", "\"0.1\"", 0) |
michael@0 | 457 | testmath("Math.floor", "\"-0.1\"", -1) |
michael@0 | 458 | testmath("Math.floor", "Number.NaN", Number.NaN) |
michael@0 | 459 | testmath("Math.floor(Number.NaN) == -Math.ceil", "-Number.NaN", false) |
michael@0 | 460 | testmath("Math.floor", "0", 0) |
michael@0 | 461 | testmath("Math.floor(0) == -Math.ceil", "-0", true) |
michael@0 | 462 | testmath("Math.floor", "-0", -0) |
michael@0 | 463 | testmath("Infinity/Math.floor", "-0", -Infinity) |
michael@0 | 464 | testmath("Math.floor(-0)== -Math.ceil", "0", true) |
michael@0 | 465 | testmath("Math.floor", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 466 | testmath("Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil", "Number.NEGATIVE_INFINITY", true) |
michael@0 | 467 | testmath("Math.floor", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) |
michael@0 | 468 | testmath("Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil", "Number.POSITIVE_INFINITY", true) |
michael@0 | 469 | testmath("Math.floor", "0.0000001", 0) |
michael@0 | 470 | testmath("Math.floor(0.0000001)==-Math.ceil", "-0.0000001", true) |
michael@0 | 471 | testmath("Math.floor", "-0.0000001", -1) |
michael@0 | 472 | testmath("Math.floor(-0.0000001)==-Math.ceil", "0.0000001", true) |
michael@0 | 473 | |
michael@0 | 474 | testmath("Math.log", "void 0", Number.NaN) |
michael@0 | 475 | testmath("Math.log", "null", Number.NEGATIVE_INFINITY) |
michael@0 | 476 | testmath("Math.log", "true", 0) |
michael@0 | 477 | testmath("Math.log", "false", -Infinity) |
michael@0 | 478 | testmath("Math.log", "'0'", -Infinity) |
michael@0 | 479 | testmath("Math.log", "'1'", 0) |
michael@0 | 480 | testmath("Math.log", "\"Infinity\"", Infinity) |
michael@0 | 481 | testmath("Math.log", "Number.NaN", Number.NaN) |
michael@0 | 482 | testmath("Math.log", "-0.000001", Number.NaN) |
michael@0 | 483 | testmath("Math.log", "-1", Number.NaN) |
michael@0 | 484 | testmath("Math.log", "0", Number.NEGATIVE_INFINITY) |
michael@0 | 485 | testmath("Math.log", "-0", Number.NEGATIVE_INFINITY) |
michael@0 | 486 | testmath("Math.log", "1", 0) |
michael@0 | 487 | testmath("Math.log", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 488 | testmath("Math.log", "Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 489 | |
michael@0 | 490 | testmath("Math.max", "void 0, 1", Number.NaN) |
michael@0 | 491 | testmath("Math.max", "void 0, void 0", Number.NaN) |
michael@0 | 492 | testmath("Math.max", "null, 1", 1) |
michael@0 | 493 | testmath("Math.max", "-1, null", 0) |
michael@0 | 494 | testmath("Math.max", "true,false", 1) |
michael@0 | 495 | testmath("Math.max", "\"-99\",\"99\"", 99) |
michael@0 | 496 | testmath("Math.max", "Number.NaN,Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 497 | testmath("Math.max", "Number.NaN, 0", Number.NaN) |
michael@0 | 498 | testmath("Math.max", "\"a string\", 0", Number.NaN) |
michael@0 | 499 | testmath("Math.max", "Number.NaN,1", Number.NaN) |
michael@0 | 500 | testmath("Math.max", "\"a string\", Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 501 | testmath("Math.max", "Number.POSITIVE_INFINITY, Number.NaN", Number.NaN) |
michael@0 | 502 | testmath("Math.max", "Number.NaN, Number.NaN", Number.NaN) |
michael@0 | 503 | testmath("Math.max", "0,Number.NaN", Number.NaN) |
michael@0 | 504 | testmath("Math.max", "1, Number.NaN", Number.NaN) |
michael@0 | 505 | testmath("Math.max", "0,0", 0) |
michael@0 | 506 | testmath("Math.max", "0,-0", 0) |
michael@0 | 507 | testmath("Math.max", "-0,0", 0) |
michael@0 | 508 | testmath("Math.max", "-0,-0", -0) |
michael@0 | 509 | testmath("Infinity/Math.max", "-0,-0", -Infinity) |
michael@0 | 510 | testmath("Math.max", "Number.POSITIVE_INFINITY, Number.MAX_VALUE", Number.POSITIVE_INFINITY) |
michael@0 | 511 | testmath("Math.max", "Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 512 | testmath("Math.max", "Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) |
michael@0 | 513 | testmath("Math.max", "1,.99999999999999", 1) |
michael@0 | 514 | testmath("Math.max", "-1,-.99999999999999", -.99999999999999) |
michael@0 | 515 | |
michael@0 | 516 | testmath("Math.min", "void 0, 1", Number.NaN) |
michael@0 | 517 | testmath("Math.min", "void 0, void 0", Number.NaN) |
michael@0 | 518 | testmath("Math.min", "null, 1", 0) |
michael@0 | 519 | testmath("Math.min", "-1, null", -1) |
michael@0 | 520 | testmath("Math.min", "true,false", 0) |
michael@0 | 521 | testmath("Math.min", "\"-99\",\"99\"", -99) |
michael@0 | 522 | testmath("Math.min", "Number.NaN,0", Number.NaN) |
michael@0 | 523 | testmath("Math.min", "Number.NaN,1", Number.NaN) |
michael@0 | 524 | testmath("Math.min", "Number.NaN,-1", Number.NaN) |
michael@0 | 525 | testmath("Math.min", "0,Number.NaN", Number.NaN) |
michael@0 | 526 | testmath("Math.min", "1,Number.NaN", Number.NaN) |
michael@0 | 527 | testmath("Math.min", "-1,Number.NaN", Number.NaN) |
michael@0 | 528 | testmath("Math.min", "Number.NaN,Number.NaN", Number.NaN) |
michael@0 | 529 | testmath("Math.min", "1,1.0000000001", 1) |
michael@0 | 530 | testmath("Math.min", "1.0000000001,1", 1) |
michael@0 | 531 | testmath("Math.min", "0,0", 0) |
michael@0 | 532 | testmath("Math.min", "0,-0", -0) |
michael@0 | 533 | testmath("Math.min", "-0,-0", -0) |
michael@0 | 534 | testmath("Infinity/Math.min", "0,-0", -Infinity) |
michael@0 | 535 | testmath("Infinity/Math.min", "-0,-0", -Infinity) |
michael@0 | 536 | |
michael@0 | 537 | testmath("Math.pow", "null,null", 1) |
michael@0 | 538 | testmath("Math.pow", "void 0, void 0", Number.NaN) |
michael@0 | 539 | testmath("Math.pow", "true, false", 1) |
michael@0 | 540 | testmath("Math.pow", "false,true", 0) |
michael@0 | 541 | testmath("Math.pow", "'2','32'", 4294967296) |
michael@0 | 542 | testmath("Math.pow", "1,Number.NaN", Number.NaN) |
michael@0 | 543 | testmath("Math.pow", "0,Number.NaN", Number.NaN) |
michael@0 | 544 | testmath("Math.pow", "Number.NaN,0", 1) |
michael@0 | 545 | testmath("Math.pow", "Number.NaN,-0", 1) |
michael@0 | 546 | testmath("Math.pow", "Number.NaN, 1", Number.NaN) |
michael@0 | 547 | testmath("Math.pow", "Number.NaN, .5", Number.NaN) |
michael@0 | 548 | testmath("Math.pow", "1.00000001, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 549 | testmath("Math.pow", "1.00000001, Number.NEGATIVE_INFINITY", 0) |
michael@0 | 550 | testmath("Math.pow", "-1.00000001,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 551 | testmath("Math.pow", "-1.00000001,Number.NEGATIVE_INFINITY", 0) |
michael@0 | 552 | testmath("Math.pow", "1, Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 553 | testmath("Math.pow", "1, Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 554 | testmath("Math.pow", "-1, Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 555 | testmath("Math.pow", "-1, Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 556 | testmath("Math.pow", ".0000000009, Number.POSITIVE_INFINITY", 0) |
michael@0 | 557 | testmath("Math.pow", "-.0000000009, Number.POSITIVE_INFINITY", 0) |
michael@0 | 558 | testmath("Math.pow", "-.0000000009, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 559 | testmath("Math.pow", "Number.POSITIVE_INFINITY,.00000000001", Number.POSITIVE_INFINITY) |
michael@0 | 560 | testmath("Math.pow", "Number.POSITIVE_INFINITY, 1", Number.POSITIVE_INFINITY) |
michael@0 | 561 | testmath("Math.pow", "Number.POSITIVE_INFINITY, -.00000000001", 0) |
michael@0 | 562 | testmath("Math.pow", "Number.POSITIVE_INFINITY, -1", 0) |
michael@0 | 563 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, 1", Number.NEGATIVE_INFINITY) |
michael@0 | 564 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, 333", Number.NEGATIVE_INFINITY) |
michael@0 | 565 | testmath("Math.pow", "Number.POSITIVE_INFINITY, 2", Number.POSITIVE_INFINITY) |
michael@0 | 566 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, 666", Number.POSITIVE_INFINITY) |
michael@0 | 567 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, 0.5", Number.POSITIVE_INFINITY) |
michael@0 | 568 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 569 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, -1", -0) |
michael@0 | 570 | testmath("Infinity/Math.pow", "Number.NEGATIVE_INFINITY, -1", -Infinity) |
michael@0 | 571 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, -3", -0) |
michael@0 | 572 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, -2", 0) |
michael@0 | 573 | testmath("Math.pow", "Number.NEGATIVE_INFINITY,-0.5", 0) |
michael@0 | 574 | testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", 0) |
michael@0 | 575 | testmath("Math.pow", "0,1", 0) |
michael@0 | 576 | testmath("Math.pow", "0,0", 1) |
michael@0 | 577 | testmath("Math.pow", "1,0", 1) |
michael@0 | 578 | testmath("Math.pow", "-1,0", 1) |
michael@0 | 579 | testmath("Math.pow", "0,0.5", 0) |
michael@0 | 580 | testmath("Math.pow", "0,1000", 0) |
michael@0 | 581 | testmath("Math.pow", "0, Number.POSITIVE_INFINITY", 0) |
michael@0 | 582 | testmath("Math.pow", "0, -1", Number.POSITIVE_INFINITY) |
michael@0 | 583 | testmath("Math.pow", "0, -0.5", Number.POSITIVE_INFINITY) |
michael@0 | 584 | testmath("Math.pow", "0, -1000", Number.POSITIVE_INFINITY) |
michael@0 | 585 | testmath("Math.pow", "0, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 586 | testmath("Math.pow", "-0, 1", -0) |
michael@0 | 587 | testmath("Math.pow", "-0,3", -0) |
michael@0 | 588 | testmath("Infinity/Math.pow", "-0, 1", -Infinity) |
michael@0 | 589 | testmath("Infinity/Math.pow", "-0,3", -Infinity) |
michael@0 | 590 | testmath("Math.pow", "-0,2", 0) |
michael@0 | 591 | testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0) |
michael@0 | 592 | testmath("Math.pow", "-0, -1", Number.NEGATIVE_INFINITY) |
michael@0 | 593 | testmath("Math.pow", "-0, -10001", Number.NEGATIVE_INFINITY) |
michael@0 | 594 | testmath("Math.pow", "-0, -2", Number.POSITIVE_INFINITY) |
michael@0 | 595 | testmath("Math.pow", "-0, 0.5", 0) |
michael@0 | 596 | testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0) |
michael@0 | 597 | testmath("Math.pow", "-1, 0.5", Number.NaN) |
michael@0 | 598 | testmath("Math.pow", "-1, Number.NaN", Number.NaN) |
michael@0 | 599 | testmath("Math.pow", "-1, -0.5", Number.NaN) |
michael@0 | 600 | |
michael@0 | 601 | testmath("Math.round", "0", 0) |
michael@0 | 602 | testmath("Math.round", "void 0", Number.NaN) |
michael@0 | 603 | testmath("Math.round", "true", 1) |
michael@0 | 604 | testmath("Math.round", "false", 0) |
michael@0 | 605 | testmath("Math.round", "'.99999'", 1) |
michael@0 | 606 | testmath("Math.round", "'12345e-2'", 123) |
michael@0 | 607 | testmath("Math.round", "Number.NaN", Number.NaN) |
michael@0 | 608 | testmath("Math.round", "0", 0) |
michael@0 | 609 | testmath("Math.round", "-0", -0) |
michael@0 | 610 | testmath("Infinity/Math.round", "-0", -Infinity) |
michael@0 | 611 | testmath("Math.round", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 612 | testmath("Math.round", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) |
michael@0 | 613 | testmath("Math.round", "0.49", 0) |
michael@0 | 614 | testmath("Math.round", "0.5", 1) |
michael@0 | 615 | testmath("Math.round", "0.51", 1) |
michael@0 | 616 | testmath("Math.round", "-0.49", -0) |
michael@0 | 617 | testmath("Math.round", "-0.5", -0) |
michael@0 | 618 | testmath("Infinity/Math.round", "-0.49", -Infinity) |
michael@0 | 619 | testmath("Infinity/Math.round", "-0.5", -Infinity) |
michael@0 | 620 | testmath("Math.round", "-0.51", -1) |
michael@0 | 621 | testmath("Math.round", "3.5", 4) |
michael@0 | 622 | testmath("Math.round", "-3", -3) |
michael@0 | 623 | |
michael@0 | 624 | testmath("Math.sin", "null", 0) |
michael@0 | 625 | testmath("Math.sin", "void 0", Number.NaN) |
michael@0 | 626 | testmath("Math.sin", "false", 0) |
michael@0 | 627 | testmath("Math.sin", "'2.356194490192'", 0.7071067811865) |
michael@0 | 628 | testmath("Math.sin", "Number.NaN", Number.NaN) |
michael@0 | 629 | testmath("Math.sin", "0", 0) |
michael@0 | 630 | testmath("Math.sin", "-0", -0) |
michael@0 | 631 | testmath("Math.sin", "Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 632 | testmath("Math.sin", "Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 633 | testmath("Math.sin", "0.7853981633974", 0.7071067811865) |
michael@0 | 634 | testmath("Math.sin", "1.570796326795", 1) |
michael@0 | 635 | testmath("Math.sin", "2.356194490192", 0.7071067811865) |
michael@0 | 636 | testmath("Math.sin", "3.14159265359", 0) |
michael@0 | 637 | |
michael@0 | 638 | testmath("Math.sqrt", "void 0", Number.NaN) |
michael@0 | 639 | testmath("Math.sqrt", "null", 0) |
michael@0 | 640 | testmath("Math.sqrt", "1", 1) |
michael@0 | 641 | testmath("Math.sqrt", "false", 0) |
michael@0 | 642 | testmath("Math.sqrt", "'225'", 15) |
michael@0 | 643 | testmath("Math.sqrt", "Number.NaN", Number.NaN) |
michael@0 | 644 | testmath("Math.sqrt", "Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 645 | testmath("Math.sqrt", "-1", Number.NaN) |
michael@0 | 646 | testmath("Math.sqrt", "-0.5", Number.NaN) |
michael@0 | 647 | testmath("Math.sqrt", "0", 0) |
michael@0 | 648 | testmath("Math.sqrt", "-0", -0) |
michael@0 | 649 | testmath("Infinity/Math.sqrt", "-0", -Infinity) |
michael@0 | 650 | testmath("Math.sqrt", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) |
michael@0 | 651 | testmath("Math.sqrt", "1", 1) |
michael@0 | 652 | testmath("Math.sqrt", "2", Math.SQRT2) |
michael@0 | 653 | testmath("Math.sqrt", "0.5", Math.SQRT1_2) |
michael@0 | 654 | testmath("Math.sqrt", "4", 2) |
michael@0 | 655 | testmath("Math.sqrt", "9", 3) |
michael@0 | 656 | testmath("Math.sqrt", "16", 4) |
michael@0 | 657 | testmath("Math.sqrt", "25", 5) |
michael@0 | 658 | testmath("Math.sqrt", "36", 6) |
michael@0 | 659 | testmath("Math.sqrt", "49", 7) |
michael@0 | 660 | testmath("Math.sqrt", "64", 8) |
michael@0 | 661 | testmath("Math.sqrt", "256", 16) |
michael@0 | 662 | testmath("Math.sqrt", "10000", 100) |
michael@0 | 663 | testmath("Math.sqrt", "65536", 256) |
michael@0 | 664 | testmath("Math.sqrt", "0.09", 0.3) |
michael@0 | 665 | testmath("Math.sqrt", "0.01", 0.1) |
michael@0 | 666 | testmath("Math.sqrt", "0.00000001", 0.0001) |
michael@0 | 667 | |
michael@0 | 668 | testmath("Math.tan", "void 0", Number.NaN) |
michael@0 | 669 | testmath("Math.tan", "null", 0) |
michael@0 | 670 | testmath("Math.tan", "false", 0) |
michael@0 | 671 | testmath("Math.tan", "Number.NaN", Number.NaN) |
michael@0 | 672 | testmath("Math.tan", "0", 0) |
michael@0 | 673 | testmath("Math.tan", "-0", -0) |
michael@0 | 674 | testmath("Math.tan", "Number.POSITIVE_INFINITY", Number.NaN) |
michael@0 | 675 | testmath("Math.tan", "Number.NEGATIVE_INFINITY", Number.NaN) |
michael@0 | 676 | testmath("Math.tan", "Math.PI/4", 1) |
michael@0 | 677 | testmath("Math.tan", "3*Math.PI/4", -1) |
michael@0 | 678 | testmath("Math.tan", "Math.PI", -0) |
michael@0 | 679 | testmath("Math.tan", "5*Math.PI/4", 1) |
michael@0 | 680 | testmath("Math.tan", "7*Math.PI/4", -1) |
michael@0 | 681 | testmath("Infinity/Math.tan", "-0", -Infinity) |
michael@0 | 682 | |
michael@0 | 683 | jit(false); |
michael@0 | 684 | |
michael@0 | 685 | /* Keep these at the end so that we can see the summary after the trace-debug spew. */ |
michael@0 | 686 | if (0) { |
michael@0 | 687 | print("\npassed:", passes.length && passes.join(",")); |
michael@0 | 688 | print("\nFAILED:", fails.length && fails.join(",")); |
michael@0 | 689 | } |