Debian Codegraph @

js/src/tests/non262/Math/15.8.2.2.js

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