Debian Codegraph @

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