tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

exp-operator.js (883B)


      1 // Copyright (C) 2016 Rick Waldron. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 author: Rick Waldron
      6 esid: sec-exp-operator
      7 description: >
      8    Performs exponential calculation on operands. Same algorithm as %MathPow%(base, exponent)
      9 features: [exponentiation]
     10 ---*/
     11 
     12 var exponent = 2;
     13 assert.sameValue(2 ** 3, 8, "(2 ** 3) === 8");
     14 assert.sameValue(3 * 2 ** 3, 24, "(3 * 2 ** 3) === 24");
     15 assert.sameValue(2 ** ++exponent, 8, "(2 ** ++exponent) === 8");
     16 assert.sameValue(2 ** -1 * 2, 1, "(2 ** -1 * 2) === 1");
     17 assert.sameValue(2 ** 2 * 4, 16, "(2 ** 2 * 4) === 16");
     18 assert.sameValue(2 ** 2 / 2, 2, "(2 ** 2 / 2) === 2");
     19 assert.sameValue(2 ** (3 ** 2), 512, "(2 ** (3 ** 2)) === 512");
     20 assert.sameValue(2 ** 3 ** 2, 512, "(2 ** 3 ** 2) === 512");
     21 assert.sameValue(16 / 2 ** 2, 4, "(16 / 2 ** 2) === 4");
     22 
     23 reportCompare(0, 0);