js/src/tests/ecma/Math/15.8.2.13.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.

     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/. */
     7 /**
     8    File Name:          15.8.2.13.js
     9    ECMA Section:       15.8.2.13 Math.pow(x, y)
    10    Description:        return an approximation to the result of x
    11    to the power of y.  there are many special cases;
    12    refer to the spec.
    13    Author:             christine@netscape.com
    14    Date:               9 july 1997
    15 */
    17 var SECTION = "15.8.2.13";
    18 var VERSION = "ECMA_1";
    19 var TITLE   = "Math.pow(x, y)";
    20 var BUGNUMBER="77141";
    22 startTest();
    24 writeHeaderToLog( SECTION + " "+ TITLE);
    26 new TestCase( SECTION,
    27 	      "Math.pow.length",
    28 	      2,
    29 	      Math.pow.length );
    31 new TestCase( SECTION,
    32 	      "Math.pow()",
    33 	      Number.NaN,
    34 	      Math.pow() );
    36 new TestCase( SECTION,
    37 	      "Math.pow(null, null)",
    38 	      1,
    39 	      Math.pow(null,null) );
    41 new TestCase( SECTION, 
    42 	      "Math.pow(void 0, void 0)",
    43 	      Number.NaN,
    44               Math.pow(void 0, void 0));
    46 new TestCase( SECTION, 
    47 	      "Math.pow(true, false)",
    48 	      1,
    49 	      Math.pow(true, false) );
    51 new TestCase( SECTION, 
    52 	      "Math.pow(false,true)",
    53 	      0,
    54 	      Math.pow(false,true) );
    56 new TestCase( SECTION, 
    57 	      "Math.pow('2','32')",
    58 	      4294967296,
    59               Math.pow('2','32') );
    61 new TestCase( SECTION, 
    62 	      "Math.pow(1,NaN)",
    63 	      Number.NaN,
    64               Math.pow(1,Number.NaN) );
    66 new TestCase( SECTION, 
    67 	      "Math.pow(0,NaN)",	
    68 	      Number.NaN,
    69               Math.pow(0,Number.NaN) );
    71 new TestCase( SECTION, 
    72 	      "Math.pow(NaN,0)",
    73 	      1,
    74 	      Math.pow(Number.NaN,0) );
    76 new TestCase( SECTION,
    77 	      "Math.pow(NaN,-0)",
    78               1,
    79 	      Math.pow(Number.NaN,-0) );
    81 new TestCase( SECTION, 
    82 	      "Math.pow(NaN,1)",
    83 	      Number.NaN,
    84               Math.pow(Number.NaN, 1) );
    86 new TestCase( SECTION, 
    87 	      "Math.pow(NaN,.5)",
    88               Number.NaN,
    89               Math.pow(Number.NaN, .5) );
    91 new TestCase( SECTION, 
    92 	      "Math.pow(1.00000001, Infinity)",
    93 	      Number.POSITIVE_INFINITY,
    94 	      Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
    96 new TestCase( SECTION, 
    97 	      "Math.pow(1.00000001, -Infinity)", 
    98 	      0,
    99 	      Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
   101 new TestCase( SECTION, 
   102 	      "Math.pow(-1.00000001, Infinity)", 
   103 	      Number.POSITIVE_INFINITY,
   104 	      Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
   106 new TestCase( SECTION, 
   107 	      "Math.pow(-1.00000001, -Infinity)",
   108 	      0,
   109 	      Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
   111 new TestCase( SECTION, 
   112 	      "Math.pow(1, Infinity)",
   113 	      Number.NaN,
   114               Math.pow(1, Number.POSITIVE_INFINITY) );
   116 new TestCase( SECTION, 
   117 	      "Math.pow(1, -Infinity)",
   118 	      Number.NaN,
   119               Math.pow(1, Number.NEGATIVE_INFINITY) );
   121 new TestCase( SECTION, 
   122 	      "Math.pow(-1, Infinity)",
   123 	      Number.NaN,
   124               Math.pow(-1, Number.POSITIVE_INFINITY) );
   126 new TestCase( SECTION, 
   127 	      "Math.pow(-1, -Infinity)",
   128 	      Number.NaN,
   129               Math.pow(-1, Number.NEGATIVE_INFINITY) );
   131 new TestCase( SECTION, 
   132 	      "Math.pow(.0000000009, Infinity)", 
   133 	      0,
   134 	      Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
   136 new TestCase( SECTION, 
   137 	      "Math.pow(-.0000000009, Infinity)",
   138 	      0,
   139 	      Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
   141 new TestCase( SECTION, 
   142 	      "Math.pow(.0000000009, -Infinity)",
   143 	      Number.POSITIVE_INFINITY,
   144 	      Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
   146 new TestCase( SECTION, 
   147 	      "Math.pow(Infinity, .00000000001)",
   148 	      Number.POSITIVE_INFINITY,
   149 	      Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
   151 new TestCase( SECTION, 
   152 	      "Math.pow(Infinity, 1)",
   153 	      Number.POSITIVE_INFINITY,
   154 	      Math.pow(Number.POSITIVE_INFINITY, 1) );
   156 new TestCase( SECTION, 
   157 	      "Math.pow(Infinity, -.00000000001)",
   158 	      0,
   159 	      Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
   161 new TestCase( SECTION, 
   162 	      "Math.pow(Infinity, -1)",
   163 	      0,
   164 	      Math.pow(Number.POSITIVE_INFINITY, -1) );
   166 new TestCase( SECTION, 
   167 	      "Math.pow(-Infinity, 1)",
   168 	      Number.NEGATIVE_INFINITY,
   169 	      Math.pow(Number.NEGATIVE_INFINITY, 1) );
   171 new TestCase( SECTION, 
   172 	      "Math.pow(-Infinity, 333)",
   173 	      Number.NEGATIVE_INFINITY,
   174 	      Math.pow(Number.NEGATIVE_INFINITY, 333) );
   176 new TestCase( SECTION, 
   177 	      "Math.pow(Infinity, 2)",
   178 	      Number.POSITIVE_INFINITY,
   179 	      Math.pow(Number.POSITIVE_INFINITY, 2) );
   181 new TestCase( SECTION, 
   182 	      "Math.pow(-Infinity, 666)",
   183 	      Number.POSITIVE_INFINITY,
   184 	      Math.pow(Number.NEGATIVE_INFINITY, 666) );
   186 new TestCase( SECTION, 
   187 	      "Math.pow(-Infinity, 0.5)",
   188 	      Number.POSITIVE_INFINITY,
   189 	      Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
   191 new TestCase( SECTION, 
   192 	      "Math.pow(-Infinity, Infinity)",
   193 	      Number.POSITIVE_INFINITY,
   194 	      Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
   196 new TestCase( SECTION, 
   197 	      "Math.pow(-Infinity, -1)",
   198 	      -0,
   199 	      Math.pow(Number.NEGATIVE_INFINITY, -1) );
   201 new TestCase( SECTION, 
   202 	      "Infinity/Math.pow(-Infinity, -1)",
   203 	      -Infinity,
   204 	      Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
   206 new TestCase( SECTION, 
   207 	      "Math.pow(-Infinity, -3)",
   208 	      -0,
   209 	      Math.pow(Number.NEGATIVE_INFINITY, -3) );
   211 new TestCase( SECTION, 
   212 	      "Math.pow(-Infinity, -2)",
   213 	      0,
   214 	      Math.pow(Number.NEGATIVE_INFINITY, -2) );
   216 new TestCase( SECTION, 
   217 	      "Math.pow(-Infinity, -0.5)",
   218 	      0,
   219 	      Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
   221 new TestCase( SECTION, 
   222 	      "Math.pow(-Infinity, -Infinity)",
   223 	      0,
   224 	      Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
   226 new TestCase( SECTION, 
   227 	      "Math.pow(0, 1)",
   228 	      0,
   229 	      Math.pow(0,1) );
   231 new TestCase( SECTION, 
   232 	      "Math.pow(0, 0)",
   233 	      1,
   234 	      Math.pow(0,0) );
   236 new TestCase( SECTION, 
   237 	      "Math.pow(1, 0)",
   238 	      1,
   239 	      Math.pow(1,0) );
   241 new TestCase( SECTION,
   242 	      "Math.pow(-1, 0)",
   243 	      1,
   244 	      Math.pow(-1,0) );
   246 new TestCase( SECTION, 
   247 	      "Math.pow(0, 0.5)",
   248               0,
   249 	      Math.pow(0,0.5) );
   251 new TestCase( SECTION, 
   252 	      "Math.pow(0, 1000)",
   253 	      0,
   254 	      Math.pow(0,1000) );
   256 new TestCase( SECTION,
   257 	      "Math.pow(0, Infinity)",
   258 	      0,
   259 	      Math.pow(0, Number.POSITIVE_INFINITY) );
   261 new TestCase( SECTION, 
   262 	      "Math.pow(0, -1)",
   263 	      Number.POSITIVE_INFINITY,
   264 	      Math.pow(0, -1) );
   266 new TestCase( SECTION, 
   267 	      "Math.pow(0, -0.5)",
   268 	      Number.POSITIVE_INFINITY,
   269 	      Math.pow(0, -0.5) );
   271 new TestCase( SECTION, 
   272 	      "Math.pow(0, -1000)",
   273 	      Number.POSITIVE_INFINITY,
   274 	      Math.pow(0, -1000) );
   276 new TestCase( SECTION, 
   277 	      "Math.pow(0, -Infinity)",
   278 	      Number.POSITIVE_INFINITY,
   279 	      Math.pow(0, Number.NEGATIVE_INFINITY) );
   281 new TestCase( SECTION, 
   282 	      "Math.pow(-0, 1)",
   283 	      -0,
   284 	      Math.pow(-0, 1) );
   286 new TestCase( SECTION, 
   287 	      "Math.pow(-0, 3)",
   288 	      -0,
   289 	      Math.pow(-0,3) );
   291 new TestCase( SECTION, 
   292 	      "Infinity/Math.pow(-0, 1)",
   293 	      -Infinity,
   294 	      Infinity/Math.pow(-0, 1) );
   296 new TestCase( SECTION, 
   297 	      "Infinity/Math.pow(-0, 3)",
   298 	      -Infinity,
   299 	      Infinity/Math.pow(-0,3) );
   301 new TestCase( SECTION, 
   302 	      "Math.pow(-0, 2)",
   303 	      0,
   304 	      Math.pow(-0,2) );
   306 new TestCase( SECTION, 
   307 	      "Math.pow(-0, Infinity)",
   308 	      0,
   309 	      Math.pow(-0, Number.POSITIVE_INFINITY) );
   311 new TestCase( SECTION, 
   312 	      "Math.pow(-0, -1)",
   313               Number.NEGATIVE_INFINITY,
   314 	      Math.pow(-0, -1) );
   316 new TestCase( SECTION, 
   317 	      "Math.pow(-0, -10001)",
   318 	      Number.NEGATIVE_INFINITY,
   319 	      Math.pow(-0, -10001) );
   321 new TestCase( SECTION, 
   322 	      "Math.pow(-0, -2)",
   323               Number.POSITIVE_INFINITY,
   324 	      Math.pow(-0, -2) );
   326 new TestCase( SECTION, 
   327 	      "Math.pow(-0, 0.5)",
   328 	      0,
   329 	      Math.pow(-0, 0.5) );
   331 new TestCase( SECTION, 
   332 	      "Math.pow(-0, Infinity)",
   333 	      0,
   334 	      Math.pow(-0, Number.POSITIVE_INFINITY) );
   336 new TestCase( SECTION, 
   337 	      "Math.pow(-1, 0.5)",
   338 	      Number.NaN,
   339               Math.pow(-1, 0.5) );
   341 new TestCase( SECTION, 
   342 	      "Math.pow(-1, NaN)",
   343 	      Number.NaN,
   344               Math.pow(-1, Number.NaN) );
   346 new TestCase( SECTION, 
   347 	      "Math.pow(-1, -0.5)",
   348 	      Number.NaN,
   349               Math.pow(-1, -0.5) );
   351 test();

mercurial