S11.6.2_A4_T8.js (1232B)
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 throw new Test262Error('#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 throw new Test262Error('#2: -Number.MAX_VALUE - umber.MAX_VALUE === Number.NEGATIVE_INFINITY. Actual: ' + (-Number.MAX_VALUE - Number.MAX_VALUE)); 20 } 21 22 //CHECK#3 23 if (1e+308 - -1e+308 !== Number.POSITIVE_INFINITY) { 24 throw new Test262Error('#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 throw new Test262Error('#4: -8.99e+307 - 8.99e+307 === Number.NEGATIVE_INFINITY. Actual: ' + (-8.99e+307 - 8.99e+307)); 30 } 31 32 reportCompare(0, 0);