S11.6.1_A4_T6.js (1515B)
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: | 6 The result of an addition is determined using the rules of IEEE 754 7 double-precision arithmetics 8 es5id: 11.6.1_A4_T6 9 description: > 10 The sum of a zero and a nonzero finite value is equal to the 11 nonzero operand 12 ---*/ 13 14 //CHECK#1 15 if (1 + -0 !== 1 ) { 16 throw new Test262Error('#1: 1 + -0 === 1. Actual: ' + (1 + -0)); 17 } 18 19 //CHECK#2 20 if (1 + 0 !== 1 ) { 21 throw new Test262Error('#2: 1 + 0 === 1. Actual: ' + (1 + 0)); 22 } 23 24 //CHECK#3 25 if (-0 + 1 !== 1 ) { 26 throw new Test262Error('#3: -0 + 1 === 1. Actual: ' + (-0 + 1)); 27 } 28 29 //CHECK#4 30 if (0 + 1 !== 1 ) { 31 throw new Test262Error('#4: 0 + 1 === 1. Actual: ' + (0 + 1)); 32 } 33 34 //CHECK#5 35 if (Number.MAX_VALUE + -0 !== Number.MAX_VALUE ) { 36 throw new Test262Error('#5: Number.MAX_VALUE + -0 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE + -0)); 37 } 38 39 //CHECK#6 40 if (Number.MAX_VALUE + 0 !== Number.MAX_VALUE ) { 41 throw new Test262Error('#6: Number.MAX_VALUE + 0 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE + 0)); 42 } 43 44 //CHECK#7 45 if (-0 + Number.MIN_VALUE !== Number.MIN_VALUE ) { 46 throw new Test262Error('#7: -0 + Number.MIN_VALUE === Number.MIN_VALUE. Actual: ' + (-0 + Number.MIN_VALUE)); 47 } 48 49 //CHECK#8 50 if (0 + Number.MIN_VALUE !== Number.MIN_VALUE ) { 51 throw new Test262Error('#8: 0 + Number.MIN_VALUE === Number.MIN_VALUE. Actual: ' + (0 + Number.MIN_VALUE)); 52 } 53 54 reportCompare(0, 0);