| 1 |
/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ |
| 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 |
/** |
| 8 |
File Name: 15.8.2.5.js |
| 9 |
ECMA Section: 15.8.2.5 atan2( y, x ) |
| 10 |
Description: |
| 11 |
|
| 12 |
Author: [email protected] |
| 13 |
Date: 7 july 1997 |
| 14 |
|
| 15 |
*/ |
| 16 |
var SECTION = "15.8.2.5"; |
| 17 |
var TITLE = "Math.atan2(x,y)"; |
| 18 |
var BUGNUMBER="76111"; |
| 19 |
|
| 20 |
printBugNumber(BUGNUMBER); |
| 21 |
|
| 22 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 23 |
|
| 24 |
new TestCase( |
| 25 |
"Math.atan2.length", |
| 26 |
2, |
| 27 |
Math.atan2.length ); |
| 28 |
|
| 29 |
new TestCase( |
| 30 |
"Math.atan2(NaN, 0)", |
| 31 |
Number.NaN, |
| 32 |
Math.atan2(Number.NaN,0) ); |
| 33 |
|
| 34 |
new TestCase( |
| 35 |
"Math.atan2(null, null)", |
| 36 |
0, |
| 37 |
Math.atan2(null, null) ); |
| 38 |
|
| 39 |
new TestCase( |
| 40 |
"Math.atan2(void 0, void 0)", |
| 41 |
Number.NaN, |
| 42 |
Math.atan2(void 0, void 0) ); |
| 43 |
|
| 44 |
new TestCase( |
| 45 |
"Math.atan2()", |
| 46 |
Number.NaN, |
| 47 |
Math.atan2() ); |
| 48 |
|
| 49 |
new TestCase( |
| 50 |
"Math.atan2(0, NaN)", |
| 51 |
Number.NaN, |
| 52 |
Math.atan2(0,Number.NaN) ); |
| 53 |
|
| 54 |
new TestCase( |
| 55 |
"Math.atan2(1, 0)", |
| 56 |
Math.PI/2, |
| 57 |
Math.atan2(1,0) ); |
| 58 |
|
| 59 |
new TestCase( |
| 60 |
"Math.atan2(1,-0)", |
| 61 |
Math.PI/2, |
| 62 |
Math.atan2(1,-0) ); |
| 63 |
|
| 64 |
new TestCase( |
| 65 |
"Math.atan2(0,0.001)", |
| 66 |
0, |
| 67 |
Math.atan2(0,0.001) ); |
| 68 |
|
| 69 |
new TestCase( |
| 70 |
"Math.atan2(0,0)", |
| 71 |
0, |
| 72 |
Math.atan2(0,0) ); |
| 73 |
|
| 74 |
new TestCase( |
| 75 |
"Math.atan2(0, -0)", |
| 76 |
Math.PI, |
| 77 |
Math.atan2(0,-0) ); |
| 78 |
|
| 79 |
new TestCase( |
| 80 |
"Math.atan2(0, -1)", |
| 81 |
Math.PI, |
| 82 |
Math.atan2(0, -1) ); |
| 83 |
|
| 84 |
new TestCase( |
| 85 |
"Math.atan2(-0, 1)", |
| 86 |
-0, |
| 87 |
Math.atan2(-0, 1) ); |
| 88 |
|
| 89 |
new TestCase( |
| 90 |
"Infinity/Math.atan2(-0, 1)", |
| 91 |
-Infinity, |
| 92 |
Infinity/Math.atan2(-0,1) ); |
| 93 |
|
| 94 |
new TestCase( |
| 95 |
"Math.atan2(-0, 0)", |
| 96 |
-0, |
| 97 |
Math.atan2(-0,0) ); |
| 98 |
|
| 99 |
new TestCase( |
| 100 |
"Math.atan2(-0, -0)", |
| 101 |
-Math.PI, |
| 102 |
Math.atan2(-0, -0) ); |
| 103 |
|
| 104 |
new TestCase( |
| 105 |
"Math.atan2(-0, -1)", |
| 106 |
-Math.PI, |
| 107 |
Math.atan2(-0, -1) ); |
| 108 |
|
| 109 |
new TestCase( |
| 110 |
"Math.atan2(-1, 0)", |
| 111 |
-Math.PI/2, |
| 112 |
Math.atan2(-1, 0) ); |
| 113 |
|
| 114 |
new TestCase( |
| 115 |
"Math.atan2(-1, -0)", |
| 116 |
-Math.PI/2, |
| 117 |
Math.atan2(-1, -0) ); |
| 118 |
|
| 119 |
new TestCase( |
| 120 |
"Math.atan2(1, Infinity)", |
| 121 |
0, |
| 122 |
Math.atan2(1, Number.POSITIVE_INFINITY) ); |
| 123 |
|
| 124 |
new TestCase( |
| 125 |
"Math.atan2(1,-Infinity)", |
| 126 |
Math.PI, |
| 127 |
Math.atan2(1, Number.NEGATIVE_INFINITY) ); |
| 128 |
|
| 129 |
new TestCase( |
| 130 |
"Math.atan2(-1, Infinity)", |
| 131 |
-0, |
| 132 |
Math.atan2(-1,Number.POSITIVE_INFINITY) ); |
| 133 |
|
| 134 |
new TestCase( |
| 135 |
"Infinity/Math.atan2(-1, Infinity)", |
| 136 |
-Infinity, |
| 137 |
Infinity/Math.atan2(-1,Infinity) ); |
| 138 |
|
| 139 |
new TestCase( |
| 140 |
"Math.atan2(-1,-Infinity)", |
| 141 |
-Math.PI, |
| 142 |
Math.atan2(-1,Number.NEGATIVE_INFINITY) ); |
| 143 |
|
| 144 |
new TestCase( |
| 145 |
"Math.atan2(Infinity, 0)", |
| 146 |
Math.PI/2, |
| 147 |
Math.atan2(Number.POSITIVE_INFINITY, 0) ); |
| 148 |
|
| 149 |
new TestCase( |
| 150 |
"Math.atan2(Infinity, 1)", |
| 151 |
Math.PI/2, |
| 152 |
Math.atan2(Number.POSITIVE_INFINITY, 1) ); |
| 153 |
|
| 154 |
new TestCase( |
| 155 |
"Math.atan2(Infinity,-1)", |
| 156 |
Math.PI/2, |
| 157 |
Math.atan2(Number.POSITIVE_INFINITY,-1) ); |
| 158 |
|
| 159 |
new TestCase( |
| 160 |
"Math.atan2(Infinity,-0)", |
| 161 |
Math.PI/2, |
| 162 |
Math.atan2(Number.POSITIVE_INFINITY,-0) ); |
| 163 |
|
| 164 |
new TestCase( |
| 165 |
"Math.atan2(-Infinity, 0)", |
| 166 |
-Math.PI/2, |
| 167 |
Math.atan2(Number.NEGATIVE_INFINITY, 0) ); |
| 168 |
|
| 169 |
new TestCase( |
| 170 |
"Math.atan2(-Infinity,-0)", |
| 171 |
-Math.PI/2, |
| 172 |
Math.atan2(Number.NEGATIVE_INFINITY,-0) ); |
| 173 |
|
| 174 |
new TestCase( |
| 175 |
"Math.atan2(-Infinity, 1)", |
| 176 |
-Math.PI/2, |
| 177 |
Math.atan2(Number.NEGATIVE_INFINITY, 1) ); |
| 178 |
|
| 179 |
new TestCase( |
| 180 |
"Math.atan2(-Infinity, -1)", |
| 181 |
-Math.PI/2, |
| 182 |
Math.atan2(Number.NEGATIVE_INFINITY,-1) ); |
| 183 |
|
| 184 |
new TestCase( |
| 185 |
"Math.atan2(Infinity, Infinity)", |
| 186 |
Math.PI/4, |
| 187 |
Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); |
| 188 |
|
| 189 |
new TestCase( |
| 190 |
"Math.atan2(Infinity, -Infinity)", |
| 191 |
3*Math.PI/4, |
| 192 |
Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); |
| 193 |
|
| 194 |
new TestCase( |
| 195 |
"Math.atan2(-Infinity, Infinity)", |
| 196 |
-Math.PI/4, |
| 197 |
Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); |
| 198 |
|
| 199 |
new TestCase( |
| 200 |
"Math.atan2(-Infinity, -Infinity)", |
| 201 |
-3*Math.PI/4, |
| 202 |
Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); |
| 203 |
|
| 204 |
new TestCase( |
| 205 |
"Math.atan2(-1, 1)", |
| 206 |
-Math.PI/4, |
| 207 |
Math.atan2( -1, 1) ); |
| 208 |
|
| 209 |
test(); |