js/src/tests/ecma/Math/15.8.2.8.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 15.8.2.8.js
michael@0 9 ECMA Section: 15.8.2.8 Math.exp(x)
michael@0 10 Description: return an approximation to the exponential function of
michael@0 11 the argument (e raised to the power of the argument)
michael@0 12 special cases:
michael@0 13 - if x is NaN return NaN
michael@0 14 - if x is 0 return 1
michael@0 15 - if x is -0 return 1
michael@0 16 - if x is Infinity return Infinity
michael@0 17 - if x is -Infinity return 0
michael@0 18 Author: christine@netscape.com
michael@0 19 Date: 7 july 1997
michael@0 20 */
michael@0 21
michael@0 22
michael@0 23 var SECTION = "15.8.2.8";
michael@0 24 var VERSION = "ECMA_1";
michael@0 25 startTest();
michael@0 26 var TITLE = "Math.exp(x)";
michael@0 27
michael@0 28 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 29
michael@0 30 new TestCase( SECTION,
michael@0 31 "Math.exp.length",
michael@0 32 1,
michael@0 33 Math.exp.length );
michael@0 34
michael@0 35 new TestCase( SECTION,
michael@0 36 "Math.exp()",
michael@0 37 Number.NaN,
michael@0 38 Math.exp() );
michael@0 39
michael@0 40 new TestCase( SECTION,
michael@0 41 "Math.exp(null)",
michael@0 42 1,
michael@0 43 Math.exp(null) );
michael@0 44
michael@0 45 new TestCase( SECTION,
michael@0 46 "Math.exp(void 0)",
michael@0 47 Number.NaN,
michael@0 48 Math.exp(void 0) );
michael@0 49
michael@0 50 new TestCase( SECTION,
michael@0 51 "Math.exp(1)",
michael@0 52 Math.E,
michael@0 53 Math.exp(1) );
michael@0 54
michael@0 55 new TestCase( SECTION,
michael@0 56 "Math.exp(true)",
michael@0 57 Math.E,
michael@0 58 Math.exp(true) );
michael@0 59
michael@0 60 new TestCase( SECTION,
michael@0 61 "Math.exp(false)",
michael@0 62 1,
michael@0 63 Math.exp(false) );
michael@0 64
michael@0 65 new TestCase( SECTION,
michael@0 66 "Math.exp('1')",
michael@0 67 Math.E,
michael@0 68 Math.exp('1') );
michael@0 69
michael@0 70 new TestCase( SECTION,
michael@0 71 "Math.exp('0')",
michael@0 72 1,
michael@0 73 Math.exp('0') );
michael@0 74
michael@0 75 new TestCase( SECTION,
michael@0 76 "Math.exp(NaN)",
michael@0 77 Number.NaN,
michael@0 78 Math.exp(Number.NaN) );
michael@0 79
michael@0 80 new TestCase( SECTION,
michael@0 81 "Math.exp(0)",
michael@0 82 1,
michael@0 83 Math.exp(0) );
michael@0 84
michael@0 85 new TestCase( SECTION,
michael@0 86 "Math.exp(-0)",
michael@0 87 1,
michael@0 88 Math.exp(-0) );
michael@0 89
michael@0 90 new TestCase( SECTION,
michael@0 91 "Math.exp(Infinity)",
michael@0 92 Number.POSITIVE_INFINITY,
michael@0 93 Math.exp(Number.POSITIVE_INFINITY) );
michael@0 94
michael@0 95 new TestCase( SECTION,
michael@0 96 "Math.exp(-Infinity)",
michael@0 97 0,
michael@0 98 Math.exp(Number.NEGATIVE_INFINITY) );
michael@0 99
michael@0 100 test();

mercurial