test262/test/language/expressions/exponentiation/applying-the-exp-operator_A19.js
Mike Pennisi 650e7add4a Improve coverage for ops involving negative zero
Prior to this commit, the modified tests used the strict equality
operator to compare computed values with negative zero. Due to the
semantics of that operator, these tests would spuriously pass if the
value under test was in fact positive zero.

Update the tests to be more precise by instead asserting equality with
the `assert.sameValue` utility method (since that method correctly
distinguishes between negative zero and positive zero).
2021-09-16 16:35:41 -04:00

19 lines
495 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright 2016 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-applying-the-exp-operator
description: If base is 0 and exponent > 0 and exponent is an odd integer, the result is 0.
---*/
var base = -0;
var exponents = [];
exponents[0] = 1;
exponents[1] = 111;
exponents[2] = 111111;
for (var i = 0; i < exponents.length; i++) {
assert.sameValue(base ** exponents[i], -0, base + " ** " + exponents[i]);
}