| 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 |
---*/ |
| 10 |
|
| 11 |
var exponent = 2; |
| 12 |
assert.sameValue(2 ** 3, 8, "(2 ** 3) === 8"); |
| 13 |
assert.sameValue(3 * 2 ** 3, 24, "(3 * 2 ** 3) === 24"); |
| 14 |
assert.sameValue(2 ** ++exponent, 8, "(2 ** ++exponent) === 8"); |
| 15 |
assert.sameValue(2 ** -1 * 2, 1, "(2 ** -1 * 2) === 1"); |
| 16 |
assert.sameValue(2 ** 2 * 4, 16, "(2 ** 2 * 4) === 16"); |
| 17 |
assert.sameValue(2 ** 2 / 2, 2, "(2 ** 2 / 2) === 2"); |
| 18 |
assert.sameValue(2 ** (3 ** 2), 512, "(2 ** (3 ** 2)) === 512"); |
| 19 |
assert.sameValue(2 ** 3 ** 2, 512, "(2 ** 3 ** 2) === 512"); |
| 20 |
assert.sameValue(16 / 2 ** 2, 4, "(16 / 2 ** 2) === 4"); |