PageRenderTime 66ms CodeModel.GetById 22ms app.highlight 38ms RepoModel.GetById 1ms app.codeStats 0ms

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

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