blob: 70196289bd18ccb45e58fed9d78c96052eeb7583 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2009 the Sputnik authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: Negating +0 produces -0, negating -0 produces +0
6es5id: 11.4.7_A4.2
7description: Checking Infinity
8---*/
9
10//CHECK#1
11var x = 0;
12x = -x;
13if (x !== -0) {
14 $ERROR('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x));
15} else {
16 if (1/x !== Number.NEGATIVE_INFINITY) {
17 $ERROR('#1.2: var x = 0; x = -x; x === - 0. Actual: +0');
18 }
19}
20
21//CHECK#2
22var x = -0;
23x = -x;
24if (x !== 0) {
25 $ERROR('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x));
26} else {
27 if (1/x !== Number.POSITIVE_INFINITY) {
28 $ERROR('#2.2: var x = -0; x = -x; x === + 0. Actual: -0');
29 }
30}