S11.6.2_A4_T7.js (1551B)
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_T7 7 description: > 8 The mathematical difference of two nonzero finite values of the 9 same magnitude and same sign is +0 10 ---*/ 11 12 //CHECK#1 13 if (Number.MIN_VALUE - Number.MIN_VALUE !== +0) { 14 throw new Test262Error('#1.1: Number.MIN_VALUE - Number.MIN_VALUE === 0. Actual: ' + (Number.MIN_VALUE - Number.MIN_VALUE)); 15 } else { 16 if (1 / (Number.MIN_VALUE - Number.MIN_VALUE) !== Number.POSITIVE_INFINITY) { 17 throw new Test262Error('#1.2: Number.MIN_VALUE - Number.MIN_VALUE === + 0. Actual: -0'); 18 } 19 } 20 21 //CHECK#2 22 if (-Number.MAX_VALUE - -Number.MAX_VALUE !== +0) { 23 throw new Test262Error('#2.2: -Number.MAX_VALUE - -Number.MAX_VALUE === 0. Actual: ' + (-Number.MAX_VALUE - -Number.MAX_VALUE)); 24 } else { 25 if (1 / (-Number.MAX_VALUE - -Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { 26 throw new Test262Error('#2.1: -Number.MAX_VALUE - -Number.MAX_VALUE === + 0. Actual: -0'); 27 } 28 } 29 30 //CHECK#3 31 if (1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE !== +0) { 32 throw new Test262Error('#3.1: 1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE === 0. Actual: ' + (1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE)); 33 } else { 34 if (1 / (1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { 35 throw new Test262Error('#3.2: 1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE === + 0. Actual: -0'); 36 } 37 } 38 39 reportCompare(0, 0);