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 ***** */
41 File Name: 15.8.2.7.js
42 ECMA Section: 15.8.2.7 cos( x )
43 Description: return an approximation to the cosine of the
44 argument. argument is expressed in radians
45 Author: christine@netscape.com
50 var SECTION = "15.8.2.7";
51 var VERSION = "ECMA_1";
53 var TITLE = "Math.cos(x)";
55 writeHeaderToLog( SECTION + " "+ TITLE);
57 new TestCase( SECTION,
62 new TestCase( SECTION,
67 new TestCase( SECTION,
72 new TestCase( SECTION,
77 new TestCase( SECTION,
82 new TestCase( SECTION,
87 new TestCase( SECTION,
88 "Math.cos('Infinity')",
90 Math.cos("Infinity") );
92 new TestCase( SECTION,
93 "Math.cos('3.14159265359')",
95 Math.cos('3.14159265359') );
97 new TestCase( SECTION,
100 Math.cos(Number.NaN) );
102 new TestCase( SECTION,
107 new TestCase( SECTION,
112 new TestCase( SECTION,
113 "Math.cos(Infinity)",
115 Math.cos(Number.POSITIVE_INFINITY) );
117 new TestCase( SECTION,
118 "Math.cos(-Infinity)",
120 Math.cos(Number.NEGATIVE_INFINITY) );
122 new TestCase( SECTION,
123 "Math.cos(0.7853981633974)",
125 Math.cos(0.7853981633974) );
127 new TestCase( SECTION,
128 "Math.cos(1.570796326795)",
130 Math.cos(1.570796326795) );
132 new TestCase( SECTION,
133 "Math.cos(2.356194490192)",
135 Math.cos(2.356194490192) );
137 new TestCase( SECTION,
138 "Math.cos(3.14159265359)",
140 Math.cos(3.14159265359) );
142 new TestCase( SECTION,
143 "Math.cos(3.926990816987)",
145 Math.cos(3.926990816987) );
147 new TestCase( SECTION,
148 "Math.cos(4.712388980385)",
150 Math.cos(4.712388980385) );
152 new TestCase( SECTION,
153 "Math.cos(5.497787143782)",
155 Math.cos(5.497787143782) );
157 new TestCase( SECTION,
158 "Math.cos(Math.PI*2)",
160 Math.cos(Math.PI*2) );
162 new TestCase( SECTION,
163 "Math.cos(Math.PI/4)",
165 Math.cos(Math.PI/4) );
167 new TestCase( SECTION,
168 "Math.cos(Math.PI/2)",
170 Math.cos(Math.PI/2) );
172 new TestCase( SECTION,
173 "Math.cos(3*Math.PI/4)",
175 Math.cos(3*Math.PI/4) );
177 new TestCase( SECTION,
182 new TestCase( SECTION,
183 "Math.cos(5*Math.PI/4)",
185 Math.cos(5*Math.PI/4) );
187 new TestCase( SECTION,
188 "Math.cos(3*Math.PI/2)",
190 Math.cos(3*Math.PI/2) );
192 new TestCase( SECTION,
193 "Math.cos(7*Math.PI/4)",
195 Math.cos(7*Math.PI/4) );
197 new TestCase( SECTION,
198 "Math.cos(Math.PI*2)",
200 Math.cos(2*Math.PI) );
202 new TestCase( SECTION,
203 "Math.cos(-0.7853981633974)",
205 Math.cos(-0.7853981633974) );
207 new TestCase( SECTION,
208 "Math.cos(-1.570796326795)",
210 Math.cos(-1.570796326795) );
212 new TestCase( SECTION,
213 "Math.cos(-2.3561944901920)",
215 Math.cos(2.3561944901920) );
217 new TestCase( SECTION,
218 "Math.cos(-3.14159265359)",
220 Math.cos(3.14159265359) );
222 new TestCase( SECTION,
223 "Math.cos(-3.926990816987)",
225 Math.cos(3.926990816987) );
227 new TestCase( SECTION,
228 "Math.cos(-4.712388980385)",
230 Math.cos(4.712388980385) );
232 new TestCase( SECTION,
233 "Math.cos(-5.497787143782)",
235 Math.cos(5.497787143782) );
237 new TestCase( SECTION,
238 "Math.cos(-6.28318530718)",
240 Math.cos(6.28318530718) );
242 new TestCase( SECTION,
243 "Math.cos(-Math.PI/4)",
245 Math.cos(-Math.PI/4) );
247 new TestCase( SECTION,
248 "Math.cos(-Math.PI/2)",
250 Math.cos(-Math.PI/2) );
252 new TestCase( SECTION,
253 "Math.cos(-3*Math.PI/4)",
255 Math.cos(-3*Math.PI/4) );
257 new TestCase( SECTION,
258 "Math.cos(-Math.PI)",
260 Math.cos(-Math.PI) );
262 new TestCase( SECTION,
263 "Math.cos(-5*Math.PI/4)",
265 Math.cos(-5*Math.PI/4) );
267 new TestCase( SECTION,
268 "Math.cos(-3*Math.PI/2)",
270 Math.cos(-3*Math.PI/2) );
272 new TestCase( SECTION,
273 "Math.cos(-7*Math.PI/4)",
275 Math.cos(-7*Math.PI/4) );
277 new TestCase( SECTION,
278 "Math.cos(-Math.PI*2)",
280 Math.cos(-Math.PI*2) );