|
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.10.js |
|
9 ECMA Section: 15.8.2.10 Math.log(x) |
|
10 Description: return an approximiation to the natural logarithm of |
|
11 the argument. |
|
12 special cases: |
|
13 - if arg is NaN result is NaN |
|
14 - if arg is <0 result is NaN |
|
15 - if arg is 0 or -0 result is -Infinity |
|
16 - if arg is 1 result is 0 |
|
17 - if arg is Infinity result is Infinity |
|
18 Author: christine@netscape.com |
|
19 Date: 7 july 1997 |
|
20 */ |
|
21 |
|
22 var SECTION = "15.8.2.10"; |
|
23 var VERSION = "ECMA_1"; |
|
24 var TITLE = "Math.log(x)"; |
|
25 var BUGNUMBER = "77391"; |
|
26 |
|
27 startTest(); |
|
28 |
|
29 writeHeaderToLog( SECTION + " "+ TITLE); |
|
30 |
|
31 |
|
32 new TestCase( SECTION, |
|
33 "Math.log.length", |
|
34 1, |
|
35 Math.log.length ); |
|
36 |
|
37 |
|
38 new TestCase( SECTION, |
|
39 "Math.log()", |
|
40 Number.NaN, |
|
41 Math.log() ); |
|
42 |
|
43 new TestCase( SECTION, |
|
44 "Math.log(void 0)", |
|
45 Number.NaN, |
|
46 Math.log(void 0) ); |
|
47 |
|
48 new TestCase( SECTION, |
|
49 "Math.log(null)", |
|
50 Number.NEGATIVE_INFINITY, |
|
51 Math.log(null) ); |
|
52 |
|
53 new TestCase( SECTION, |
|
54 "Math.log(true)", |
|
55 0, |
|
56 Math.log(true) ); |
|
57 |
|
58 new TestCase( SECTION, |
|
59 "Math.log(false)", |
|
60 -Infinity, |
|
61 Math.log(false) ); |
|
62 |
|
63 new TestCase( SECTION, |
|
64 "Math.log('0')", |
|
65 -Infinity, |
|
66 Math.log('0') ); |
|
67 |
|
68 new TestCase( SECTION, |
|
69 "Math.log('1')", |
|
70 0, |
|
71 Math.log('1') ); |
|
72 |
|
73 new TestCase( SECTION, |
|
74 "Math.log('Infinity')", |
|
75 Infinity, |
|
76 Math.log("Infinity") ); |
|
77 |
|
78 |
|
79 new TestCase( SECTION, |
|
80 "Math.log(NaN)", |
|
81 Number.NaN, |
|
82 Math.log(Number.NaN) ); |
|
83 |
|
84 new TestCase( SECTION, |
|
85 "Math.log(-0.0000001)", |
|
86 Number.NaN, |
|
87 Math.log(-0.000001) ); |
|
88 |
|
89 new TestCase( SECTION, |
|
90 "Math.log(-1)", |
|
91 Number.NaN, |
|
92 Math.log(-1) ); |
|
93 |
|
94 new TestCase( SECTION, |
|
95 "Math.log(0)", |
|
96 Number.NEGATIVE_INFINITY, |
|
97 Math.log(0) ); |
|
98 |
|
99 new TestCase( SECTION, |
|
100 "Math.log(-0)", |
|
101 Number.NEGATIVE_INFINITY, |
|
102 Math.log(-0)); |
|
103 |
|
104 new TestCase( SECTION, |
|
105 "Math.log(1)", |
|
106 0, |
|
107 Math.log(1) ); |
|
108 |
|
109 new TestCase( SECTION, |
|
110 "Math.log(Infinity)", |
|
111 Number.POSITIVE_INFINITY, |
|
112 Math.log(Number.POSITIVE_INFINITY) ); |
|
113 |
|
114 new TestCase( SECTION, |
|
115 "Math.log(-Infinity)", |
|
116 Number.NaN, |
|
117 Math.log(Number.NEGATIVE_INFINITY) ); |
|
118 |
|
119 test(); |