| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: If either x or y is NaN, Math(x,y) is NaN |
| 6 |
es5id: 15.8.2.5_A1 |
| 7 |
description: > |
| 8 |
Checking if Math.atan2(NaN,y) and Math.atan2(x,NaN) is NaN for |
| 9 |
different x and y values |
| 10 |
---*/ |
| 11 |
|
| 12 |
// CHECK#1 |
| 13 |
|
| 14 |
var vals = new Array(); |
| 15 |
vals[0] = -Infinity; |
| 16 |
vals[1] = -0.000000000000001; |
| 17 |
vals[2] = -0; |
| 18 |
vals[3] = +0 |
| 19 |
vals[4] = 0.000000000000001; |
| 20 |
vals[5] = +Infinity; |
| 21 |
vals[6] = NaN; |
| 22 |
var valnum = 7; |
| 23 |
|
| 24 |
var args = new Array(); |
| 25 |
for (var i = 0; i < 2; i++) |
| 26 |
{ |
| 27 |
args[i] = NaN; |
| 28 |
for (var j = 0; j < valnum; j++) |
| 29 |
{ |
| 30 |
args[1 - i] = vals[j]; |
| 31 |
assert.sameValue( |
| 32 |
Math.atan2(args[0], args[1]), |
| 33 |
NaN, |
| 34 |
"(" + args[0] + ", " + args[1] + ")" |
| 35 |
); |
| 36 |
} |
| 37 |
} |