| 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.4.js |
| 9 |
ECMA Section: 15.8.2.4 atan( x ) |
| 10 |
Description: return an approximation to the arc tangent of the |
| 11 |
argument. the result is expressed in radians and |
| 12 |
range is from -PI/2 to +PI/2. special cases: |
| 13 |
- if x is NaN, the result is NaN |
| 14 |
- if x == +0, the result is +0 |
| 15 |
- if x == -0, the result is -0 |
| 16 |
- if x == +Infinity, the result is approximately +PI/2 |
| 17 |
- if x == -Infinity, the result is approximately -PI/2 |
| 18 |
Author: [email protected] |
| 19 |
Date: 7 july 1997 |
| 20 |
|
| 21 |
*/ |
| 22 |
|
| 23 |
var SECTION = "15.8.2.4"; |
| 24 |
var TITLE = "Math.atan()"; |
| 25 |
var BUGNUMBER="77391"; |
| 26 |
|
| 27 |
printBugNumber(BUGNUMBER); |
| 28 |
|
| 29 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 30 |
|
| 31 |
new TestCase( |
| 32 |
"Math.atan.length", |
| 33 |
1, |
| 34 |
Math.atan.length ); |
| 35 |
|
| 36 |
new TestCase( |
| 37 |
"Math.atan()", |
| 38 |
Number.NaN, |
| 39 |
Math.atan() ); |
| 40 |
|
| 41 |
new TestCase( |
| 42 |
"Math.atan(void 0)", |
| 43 |
Number.NaN, |
| 44 |
Math.atan(void 0) ); |
| 45 |
|
| 46 |
new TestCase( |
| 47 |
"Math.atan(null)", |
| 48 |
0, |
| 49 |
Math.atan(null) ); |
| 50 |
|
| 51 |
new TestCase( |
| 52 |
"Math.atan(NaN)", |
| 53 |
Number.NaN, |
| 54 |
Math.atan(Number.NaN) ); |
| 55 |
|
| 56 |
new TestCase( |
| 57 |
"Math.atan('a string')", |
| 58 |
Number.NaN, |
| 59 |
Math.atan("a string") ); |
| 60 |
|
| 61 |
new TestCase( |
| 62 |
"Math.atan('0')", |
| 63 |
0, |
| 64 |
Math.atan('0') ); |
| 65 |
|
| 66 |
new TestCase( |
| 67 |
"Math.atan('1')", |
| 68 |
Math.PI/4, |
| 69 |
Math.atan('1') ); |
| 70 |
|
| 71 |
new TestCase( |
| 72 |
"Math.atan('-1')", |
| 73 |
-Math.PI/4, |
| 74 |
Math.atan('-1') ); |
| 75 |
|
| 76 |
new TestCase( |
| 77 |
"Math.atan('Infinity)", |
| 78 |
Math.PI/2, |
| 79 |
Math.atan('Infinity') ); |
| 80 |
|
| 81 |
new TestCase( |
| 82 |
"Math.atan('-Infinity)", |
| 83 |
-Math.PI/2, |
| 84 |
Math.atan('-Infinity') ); |
| 85 |
|
| 86 |
new TestCase( |
| 87 |
"Math.atan(0)", |
| 88 |
0, |
| 89 |
Math.atan(0) ); |
| 90 |
|
| 91 |
new TestCase( |
| 92 |
"Math.atan(-0)", |
| 93 |
-0, |
| 94 |
Math.atan(-0) ); |
| 95 |
|
| 96 |
new TestCase( |
| 97 |
"Infinity/Math.atan(-0)", |
| 98 |
-Infinity, |
| 99 |
Infinity/Math.atan(-0) ); |
| 100 |
|
| 101 |
new TestCase( |
| 102 |
"Math.atan(Infinity)", |
| 103 |
Math.PI/2, |
| 104 |
Math.atan(Number.POSITIVE_INFINITY) ); |
| 105 |
|
| 106 |
new TestCase( |
| 107 |
"Math.atan(-Infinity)", |
| 108 |
-Math.PI/2, |
| 109 |
Math.atan(Number.NEGATIVE_INFINITY) ); |
| 110 |
|
| 111 |
new TestCase( |
| 112 |
"Math.atan(1)", |
| 113 |
Math.PI/4, |
| 114 |
Math.atan(1) ); |
| 115 |
|
| 116 |
new TestCase( |
| 117 |
"Math.atan(-1)", |
| 118 |
-Math.PI/4, |
| 119 |
Math.atan(-1) ); |
| 120 |
|
| 121 |
test(); |