Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/subtraction/S11.6.2_A4_T5.js

raw
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 info: Operator x - y produces the same result as x + (-y)
6 es5id: 11.6.2_A4_T5
7 description: >
8 Using the rule of sum of two zeroes and the fact that a - b = a +
9 (-b)
10 ---*/
11
12 //CHECK#1
13 if (-0 - -0 !== 0 ) {
14 $ERROR('#1.1: -0 - -0 === 0. Actual: ' + (-0 - -0));
15 } else {
16 if (1 / (-0 - -0) !== Number.POSITIVE_INFINITY) {
17 $ERROR('#1.2: -0 - -0 === + 0. Actual: -0');
18 }
19 }
20
21 //CHECK#2
22 if (0 - -0 !== 0 ) {
23 $ERROR('#2.1: 0 - -0 === 0. Actual: ' + (0 - -0));
24 } else {
25 if (1 / (0 - -0) !== Number.POSITIVE_INFINITY) {
26 $ERROR('#2.2: 0 - -0 === + 0. Actual: -0');
27 }
28 }
29
30 //CHECK#3
31 if (-0 - 0 !== -0 ) {
32 $ERROR('#3.1: -0 - 0 === 0. Actual: ' + (-0 - 0));
33 } else {
34 if (1 / (-0 - 0) !== Number.NEGATIVE_INFINITY) {
35 $ERROR('#3.2: -0 - 0 === - 0. Actual: +0');
36 }
37 }
38
39 //CHECK#4
40 if (0 - 0 !== 0 ) {
41 $ERROR('#4.1: 0 - 0 === 0. Actual: ' + (0 - 0));
42 } else {
43 if (1 / (0 - 0) !== Number.POSITIVE_INFINITY) {
44 $ERROR('#4.2: 0 - 0 === + 0. Actual: -0');
45 }
46 }