|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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: christine@netscape.com |
|
19 Date: 7 july 1997 |
|
20 |
|
21 */ |
|
22 |
|
23 var SECTION = "15.8.2.4"; |
|
24 var VERSION = "ECMA_1"; |
|
25 var TITLE = "Math.atan()"; |
|
26 var BUGNUMBER="77391"; |
|
27 |
|
28 startTest(); |
|
29 |
|
30 writeHeaderToLog( SECTION + " "+ TITLE); |
|
31 |
|
32 new TestCase( SECTION, |
|
33 "Math.atan.length", |
|
34 1, |
|
35 Math.atan.length ); |
|
36 |
|
37 new TestCase( SECTION, |
|
38 "Math.atan()", |
|
39 Number.NaN, |
|
40 Math.atan() ); |
|
41 |
|
42 new TestCase( SECTION, |
|
43 "Math.atan(void 0)", |
|
44 Number.NaN, |
|
45 Math.atan(void 0) ); |
|
46 |
|
47 new TestCase( SECTION, |
|
48 "Math.atan(null)", |
|
49 0, |
|
50 Math.atan(null) ); |
|
51 |
|
52 new TestCase( SECTION, |
|
53 "Math.atan(NaN)", |
|
54 Number.NaN, |
|
55 Math.atan(Number.NaN) ); |
|
56 |
|
57 new TestCase( SECTION, |
|
58 "Math.atan('a string')", |
|
59 Number.NaN, |
|
60 Math.atan("a string") ); |
|
61 |
|
62 new TestCase( SECTION, |
|
63 "Math.atan('0')", |
|
64 0, |
|
65 Math.atan('0') ); |
|
66 |
|
67 new TestCase( SECTION, |
|
68 "Math.atan('1')", |
|
69 Math.PI/4, |
|
70 Math.atan('1') ); |
|
71 |
|
72 new TestCase( SECTION, |
|
73 "Math.atan('-1')", |
|
74 -Math.PI/4, |
|
75 Math.atan('-1') ); |
|
76 |
|
77 new TestCase( SECTION, |
|
78 "Math.atan('Infinity)", |
|
79 Math.PI/2, |
|
80 Math.atan('Infinity') ); |
|
81 |
|
82 new TestCase( SECTION, |
|
83 "Math.atan('-Infinity)", |
|
84 -Math.PI/2, |
|
85 Math.atan('-Infinity') ); |
|
86 |
|
87 new TestCase( SECTION, |
|
88 "Math.atan(0)", |
|
89 0, |
|
90 Math.atan(0) ); |
|
91 |
|
92 new TestCase( SECTION, |
|
93 "Math.atan(-0)", |
|
94 -0, |
|
95 Math.atan(-0) ); |
|
96 |
|
97 new TestCase( SECTION, |
|
98 "Infinity/Math.atan(-0)", |
|
99 -Infinity, |
|
100 Infinity/Math.atan(-0) ); |
|
101 |
|
102 new TestCase( SECTION, |
|
103 "Math.atan(Infinity)", |
|
104 Math.PI/2, |
|
105 Math.atan(Number.POSITIVE_INFINITY) ); |
|
106 |
|
107 new TestCase( SECTION, |
|
108 "Math.atan(-Infinity)", |
|
109 -Math.PI/2, |
|
110 Math.atan(Number.NEGATIVE_INFINITY) ); |
|
111 |
|
112 new TestCase( SECTION, |
|
113 "Math.atan(1)", |
|
114 Math.PI/4, |
|
115 Math.atan(1) ); |
|
116 |
|
117 new TestCase( SECTION, |
|
118 "Math.atan(-1)", |
|
119 -Math.PI/4, |
|
120 Math.atan(-1) ); |
|
121 |
|
122 test(); |