Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/subtraction/S11.6.2_A4_T8.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_T8
7 description: >
8 If the magnitude is too large to represent, the operation
9 overflows and the result is then an infinity of appropriate sign
10 ---*/
11
12 //CHECK#1
13 if (Number.MAX_VALUE - -Number.MAX_VALUE !== Number.POSITIVE_INFINITY) {
14 $ERROR('#1: Number.MAX_VALUE - -Number.MAX_VALUE === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE - -Number.MAX_VALUE));
15 }
16
17 //CHECK#2
18 if (-Number.MAX_VALUE - Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) {
19 $ERROR('#2: -Number.MAX_VALUE - umber.MAX_VALUE === Number.NEGATIVE_INFINITY. Actual: ' + (-Number.MAX_VALUE - umber.MAX_VALUE));
20 }
21
22 //CHECK#3
23 if (1e+308 - -1e+308 !== Number.POSITIVE_INFINITY) {
24 $ERROR('#3: 1e+308 - -1e+308 === Number.POSITIVE_INFINITY. Actual: ' + (1e+308 - -1e+308));
25 }
26
27 //CHECK#4
28 if (-8.99e+307 - 8.99e+307 !== Number.NEGATIVE_INFINITY) {
29 $ERROR('#4: -8.99e+307 - 8.99e+307 === Number.NEGATIVE_INFINITY. Actual: ' + (-8.99e+307 - 8.99e+307));
30 }