michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 15.8.2.8.js michael@0: ECMA Section: 15.8.2.8 Math.exp(x) michael@0: Description: return an approximation to the exponential function of michael@0: the argument (e raised to the power of the argument) michael@0: special cases: michael@0: - if x is NaN return NaN michael@0: - if x is 0 return 1 michael@0: - if x is -0 return 1 michael@0: - if x is Infinity return Infinity michael@0: - if x is -Infinity return 0 michael@0: Author: christine@netscape.com michael@0: Date: 7 july 1997 michael@0: */ michael@0: michael@0: michael@0: var SECTION = "15.8.2.8"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "Math.exp(x)"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp.length", michael@0: 1, michael@0: Math.exp.length ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp()", michael@0: Number.NaN, michael@0: Math.exp() ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(null)", michael@0: 1, michael@0: Math.exp(null) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(void 0)", michael@0: Number.NaN, michael@0: Math.exp(void 0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(1)", michael@0: Math.E, michael@0: Math.exp(1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(true)", michael@0: Math.E, michael@0: Math.exp(true) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(false)", michael@0: 1, michael@0: Math.exp(false) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp('1')", michael@0: Math.E, michael@0: Math.exp('1') ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp('0')", michael@0: 1, michael@0: Math.exp('0') ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(NaN)", michael@0: Number.NaN, michael@0: Math.exp(Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(0)", michael@0: 1, michael@0: Math.exp(0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(-0)", michael@0: 1, michael@0: Math.exp(-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(Infinity)", michael@0: Number.POSITIVE_INFINITY, michael@0: Math.exp(Number.POSITIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.exp(-Infinity)", michael@0: 0, michael@0: Math.exp(Number.NEGATIVE_INFINITY) ); michael@0: michael@0: test();