• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15assert ( isNaN (Math.pow (0.0 /* any number */, NaN)) );
16assert ( Math.pow (NaN, 0.0) === 1.0 );
17assert ( Math.pow (NaN, -0.0) === 1.0 );
18assert ( isNaN (Math.pow (NaN, 1.0 /* any non-zero number */)) );
19assert ( Math.pow (2.0, Infinity) === Infinity );
20assert ( Math.pow (2.0, -Infinity) === 0.0 );
21assert ( isNaN (Math.pow (1.0, Infinity)) );
22assert ( isNaN (Math.pow (1.0, -Infinity)) );
23assert ( Math.pow (0.5, Infinity) === 0.0 );
24assert ( Math.pow (0.5, -Infinity) === Infinity );
25assert ( Math.pow (Infinity, 1.0) === Infinity );
26assert ( Math.pow (Infinity, -1.0) === 0 );
27assert ( Math.pow (-Infinity, 3.0) === -Infinity );
28assert ( Math.pow (-Infinity, 2.0) === Infinity );
29assert ( Math.pow (-Infinity, 2.5) === Infinity );
30assert ( Math.pow (-Infinity, -3.0) === -0.0 );
31assert ( Math.pow (-Infinity, -2.0) === 0.0 );
32assert ( Math.pow (-Infinity, -2.5) === 0.0 );
33assert ( Math.pow (0.0, 1.2) === 0.0 );
34assert ( Math.pow (0.0, -1.2) === Infinity );
35assert ( Math.pow (-0.0, 3.0) === -0.0 );
36assert ( Math.pow (-0.0, 2.0) === 0.0 );
37assert ( Math.pow (-0.0, 2.5) === 0.0 );
38assert ( Math.pow (-0.0, -3.0) === -Infinity );
39assert ( Math.pow (-0.0, -2.0) === Infinity );
40assert ( Math.pow (-0.0, -2.5) === Infinity );
41assert ( isNaN (Math.pow (-3, 2.5)) );
42
43assert(Math.pow (-2, 2) === 4);
44assert(Math.pow (2, 2) === 4);
45
46assert(Math.pow (2, 3) === 8);
47assert(Math.pow (-2, 3) === -8);
48
49assert(Math.pow (5, 3) === 125);
50assert(Math.pow (-5, 3) === -125);
51