| 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.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: [email protected] |
| 19 |
Date: 7 july 1997 |
| 20 |
*/ |
| 21 |
|
| 22 |
|
| 23 |
var SECTION = "15.8.2.8"; |
| 24 |
var TITLE = "Math.exp(x)"; |
| 25 |
|
| 26 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 27 |
|
| 28 |
new TestCase( "Math.exp.length", |
| 29 |
1, |
| 30 |
Math.exp.length ); |
| 31 |
|
| 32 |
new TestCase( "Math.exp()", |
| 33 |
Number.NaN, |
| 34 |
Math.exp() ); |
| 35 |
|
| 36 |
new TestCase( "Math.exp(null)", |
| 37 |
1, |
| 38 |
Math.exp(null) ); |
| 39 |
|
| 40 |
new TestCase( "Math.exp(void 0)", |
| 41 |
Number.NaN, |
| 42 |
Math.exp(void 0) ); |
| 43 |
|
| 44 |
new TestCase( "Math.exp(1)", |
| 45 |
Math.E, |
| 46 |
Math.exp(1) ); |
| 47 |
|
| 48 |
new TestCase( "Math.exp(true)", |
| 49 |
Math.E, |
| 50 |
Math.exp(true) ); |
| 51 |
|
| 52 |
new TestCase( "Math.exp(false)", |
| 53 |
1, |
| 54 |
Math.exp(false) ); |
| 55 |
|
| 56 |
new TestCase( "Math.exp('1')", |
| 57 |
Math.E, |
| 58 |
Math.exp('1') ); |
| 59 |
|
| 60 |
new TestCase( "Math.exp('0')", |
| 61 |
1, |
| 62 |
Math.exp('0') ); |
| 63 |
|
| 64 |
new TestCase( "Math.exp(NaN)", |
| 65 |
Number.NaN, |
| 66 |
Math.exp(Number.NaN) ); |
| 67 |
|
| 68 |
new TestCase( "Math.exp(0)", |
| 69 |
1, |
| 70 |
Math.exp(0) ); |
| 71 |
|
| 72 |
new TestCase( "Math.exp(-0)", |
| 73 |
1, |
| 74 |
Math.exp(-0) ); |
| 75 |
|
| 76 |
new TestCase( "Math.exp(Infinity)", |
| 77 |
Number.POSITIVE_INFINITY, |
| 78 |
Math.exp(Number.POSITIVE_INFINITY) ); |
| 79 |
|
| 80 |
new TestCase( "Math.exp(-Infinity)", |
| 81 |
0, |
| 82 |
Math.exp(Number.NEGATIVE_INFINITY) ); |
| 83 |
|
| 84 |
test(); |