|
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.8.js |
|
9 ECMA Section: 15.8.2.8 Math.exp(x) |
|
10 Description: return an approximation to the exponential function of |
|
11 the argument (e raised to the power of the argument) |
|
12 special cases: |
|
13 - if x is NaN return NaN |
|
14 - if x is 0 return 1 |
|
15 - if x is -0 return 1 |
|
16 - if x is Infinity return Infinity |
|
17 - if x is -Infinity return 0 |
|
18 Author: christine@netscape.com |
|
19 Date: 7 july 1997 |
|
20 */ |
|
21 |
|
22 |
|
23 var SECTION = "15.8.2.8"; |
|
24 var VERSION = "ECMA_1"; |
|
25 startTest(); |
|
26 var TITLE = "Math.exp(x)"; |
|
27 |
|
28 writeHeaderToLog( SECTION + " "+ TITLE); |
|
29 |
|
30 new TestCase( SECTION, |
|
31 "Math.exp.length", |
|
32 1, |
|
33 Math.exp.length ); |
|
34 |
|
35 new TestCase( SECTION, |
|
36 "Math.exp()", |
|
37 Number.NaN, |
|
38 Math.exp() ); |
|
39 |
|
40 new TestCase( SECTION, |
|
41 "Math.exp(null)", |
|
42 1, |
|
43 Math.exp(null) ); |
|
44 |
|
45 new TestCase( SECTION, |
|
46 "Math.exp(void 0)", |
|
47 Number.NaN, |
|
48 Math.exp(void 0) ); |
|
49 |
|
50 new TestCase( SECTION, |
|
51 "Math.exp(1)", |
|
52 Math.E, |
|
53 Math.exp(1) ); |
|
54 |
|
55 new TestCase( SECTION, |
|
56 "Math.exp(true)", |
|
57 Math.E, |
|
58 Math.exp(true) ); |
|
59 |
|
60 new TestCase( SECTION, |
|
61 "Math.exp(false)", |
|
62 1, |
|
63 Math.exp(false) ); |
|
64 |
|
65 new TestCase( SECTION, |
|
66 "Math.exp('1')", |
|
67 Math.E, |
|
68 Math.exp('1') ); |
|
69 |
|
70 new TestCase( SECTION, |
|
71 "Math.exp('0')", |
|
72 1, |
|
73 Math.exp('0') ); |
|
74 |
|
75 new TestCase( SECTION, |
|
76 "Math.exp(NaN)", |
|
77 Number.NaN, |
|
78 Math.exp(Number.NaN) ); |
|
79 |
|
80 new TestCase( SECTION, |
|
81 "Math.exp(0)", |
|
82 1, |
|
83 Math.exp(0) ); |
|
84 |
|
85 new TestCase( SECTION, |
|
86 "Math.exp(-0)", |
|
87 1, |
|
88 Math.exp(-0) ); |
|
89 |
|
90 new TestCase( SECTION, |
|
91 "Math.exp(Infinity)", |
|
92 Number.POSITIVE_INFINITY, |
|
93 Math.exp(Number.POSITIVE_INFINITY) ); |
|
94 |
|
95 new TestCase( SECTION, |
|
96 "Math.exp(-Infinity)", |
|
97 0, |
|
98 Math.exp(Number.NEGATIVE_INFINITY) ); |
|
99 |
|
100 test(); |