1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is Mozilla Communicator client code, released
18
* The Initial Developer of the Original Code is
19
* Netscape Communications Corporation.
20
* Portions created by the Initial Developer are Copyright (C) 1998
21
* the Initial Developer. All Rights Reserved.
25
* Alternatively, the contents of this file may be used under the terms of
26
* either the GNU General Public License Version 2 or later (the "GPL"), or
27
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
* in which case the provisions of the GPL or the LGPL are applicable instead
29
* of those above. If you wish to allow use of your version of this file only
30
* under the terms of either the GPL or the LGPL, and not to allow others to
31
* use your version of this file under the terms of the MPL, indicate your
32
* decision by deleting the provisions above and replace them with the notice
33
* and other provisions required by the GPL or the LGPL. If you do not delete
34
* the provisions above, a recipient may use your version of this file under
35
* the terms of any one of the MPL, the GPL or the LGPL.
37
* ***** END LICENSE BLOCK ***** */
40
File Name: 15.8.2.7.js
41
ECMA Section: 15.8.2.7 cos( x )
42
Description: return an approximation to the cosine of the
43
argument. argument is expressed in radians
44
Author: christine@netscape.com
49
var SECTION = "15.8.2.7";
50
var VERSION = "ECMA_1";
52
var TITLE = "Math.cos(x)";
54
writeHeaderToLog( SECTION + " "+ TITLE);
56
new TestCase( SECTION,
61
new TestCase( SECTION,
66
new TestCase( SECTION,
71
new TestCase( SECTION,
76
new TestCase( SECTION,
81
new TestCase( SECTION,
86
new TestCase( SECTION,
87
"Math.cos('Infinity')",
89
Math.cos("Infinity") );
91
new TestCase( SECTION,
92
"Math.cos('3.14159265359')",
94
Math.cos('3.14159265359') );
96
new TestCase( SECTION,
99
Math.cos(Number.NaN) );
101
new TestCase( SECTION,
106
new TestCase( SECTION,
111
new TestCase( SECTION,
112
"Math.cos(Infinity)",
114
Math.cos(Number.POSITIVE_INFINITY) );
116
new TestCase( SECTION,
117
"Math.cos(-Infinity)",
119
Math.cos(Number.NEGATIVE_INFINITY) );
121
new TestCase( SECTION,
122
"Math.cos(0.7853981633974)",
124
Math.cos(0.7853981633974) );
126
new TestCase( SECTION,
127
"Math.cos(1.570796326795)",
129
Math.cos(1.570796326795) );
131
new TestCase( SECTION,
132
"Math.cos(2.356194490192)",
134
Math.cos(2.356194490192) );
136
new TestCase( SECTION,
137
"Math.cos(3.14159265359)",
139
Math.cos(3.14159265359) );
141
new TestCase( SECTION,
142
"Math.cos(3.926990816987)",
144
Math.cos(3.926990816987) );
146
new TestCase( SECTION,
147
"Math.cos(4.712388980385)",
149
Math.cos(4.712388980385) );
151
new TestCase( SECTION,
152
"Math.cos(5.497787143782)",
154
Math.cos(5.497787143782) );
156
new TestCase( SECTION,
157
"Math.cos(Math.PI*2)",
159
Math.cos(Math.PI*2) );
161
new TestCase( SECTION,
162
"Math.cos(Math.PI/4)",
164
Math.cos(Math.PI/4) );
166
new TestCase( SECTION,
167
"Math.cos(Math.PI/2)",
169
Math.cos(Math.PI/2) );
171
new TestCase( SECTION,
172
"Math.cos(3*Math.PI/4)",
174
Math.cos(3*Math.PI/4) );
176
new TestCase( SECTION,
181
new TestCase( SECTION,
182
"Math.cos(5*Math.PI/4)",
184
Math.cos(5*Math.PI/4) );
186
new TestCase( SECTION,
187
"Math.cos(3*Math.PI/2)",
189
Math.cos(3*Math.PI/2) );
191
new TestCase( SECTION,
192
"Math.cos(7*Math.PI/4)",
194
Math.cos(7*Math.PI/4) );
196
new TestCase( SECTION,
197
"Math.cos(Math.PI*2)",
199
Math.cos(2*Math.PI) );
201
new TestCase( SECTION,
202
"Math.cos(-0.7853981633974)",
204
Math.cos(-0.7853981633974) );
206
new TestCase( SECTION,
207
"Math.cos(-1.570796326795)",
209
Math.cos(-1.570796326795) );
211
new TestCase( SECTION,
212
"Math.cos(-2.3561944901920)",
214
Math.cos(2.3561944901920) );
216
new TestCase( SECTION,
217
"Math.cos(-3.14159265359)",
219
Math.cos(3.14159265359) );
221
new TestCase( SECTION,
222
"Math.cos(-3.926990816987)",
224
Math.cos(3.926990816987) );
226
new TestCase( SECTION,
227
"Math.cos(-4.712388980385)",
229
Math.cos(4.712388980385) );
231
new TestCase( SECTION,
232
"Math.cos(-5.497787143782)",
234
Math.cos(5.497787143782) );
236
new TestCase( SECTION,
237
"Math.cos(-6.28318530718)",
239
Math.cos(6.28318530718) );
241
new TestCase( SECTION,
242
"Math.cos(-Math.PI/4)",
244
Math.cos(-Math.PI/4) );
246
new TestCase( SECTION,
247
"Math.cos(-Math.PI/2)",
249
Math.cos(-Math.PI/2) );
251
new TestCase( SECTION,
252
"Math.cos(-3*Math.PI/4)",
254
Math.cos(-3*Math.PI/4) );
256
new TestCase( SECTION,
257
"Math.cos(-Math.PI)",
259
Math.cos(-Math.PI) );
261
new TestCase( SECTION,
262
"Math.cos(-5*Math.PI/4)",
264
Math.cos(-5*Math.PI/4) );
266
new TestCase( SECTION,
267
"Math.cos(-3*Math.PI/2)",
269
Math.cos(-3*Math.PI/2) );
271
new TestCase( SECTION,
272
"Math.cos(-7*Math.PI/4)",
274
Math.cos(-7*Math.PI/4) );
276
new TestCase( SECTION,
277
"Math.cos(-Math.PI*2)",
279
Math.cos(-Math.PI*2) );