|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * Negating +0 produces -0, negating -0 produces +0 |
|
6 * |
|
7 * @path ch11/11.4/11.4.7/S11.4.7_A4.2.js |
|
8 * @description Checking Infinity |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 var x = 0; |
|
13 x = -x; |
|
14 if (x !== -0) { |
|
15 $ERROR('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x)); |
|
16 } else { |
|
17 if (1/x !== Number.NEGATIVE_INFINITY) { |
|
18 $ERROR('#1.2: var x = 0; x = -x; x === - 0. Actual: +0'); |
|
19 } |
|
20 } |
|
21 |
|
22 //CHECK#2 |
|
23 var x = -0; |
|
24 x = -x; |
|
25 if (x !== 0) { |
|
26 $ERROR('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x)); |
|
27 } else { |
|
28 if (1/x !== Number.POSITIVE_INFINITY) { |
|
29 $ERROR('#2.2: var x = -0; x = -x; x === + 0. Actual: -0'); |
|
30 } |
|
31 } |
|
32 |
|
33 |