S11.5.2_A4_T10.js (2173B)
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 division is determined by the specification of IEEE 754 7 arithmetics 8 es5id: 11.5.2_A4_T10 9 description: > 10 If both operands are finite and nonzero, the quotient is computed 11 and rounded using IEEE 754 round-to-nearest mode. If the 12 magnitude is too small to represent, the result is then a zero of 13 appropriate sign 14 ---*/ 15 16 //CHECK#1 17 if (Number.MIN_VALUE / 2.1 !== 0) { 18 throw new Test262Error('#1: Number.MIN_VALUE / 2.1 === 0. Actual: ' + (Number.MIN_VALUE / 2.1)); 19 } 20 21 //CHECK#2 22 if (Number.MIN_VALUE / -2.1 !== -0) { 23 throw new Test262Error('#2.1: Number.MIN_VALUE / -2.1 === 0. Actual: ' + (Number.MIN_VALUE / -2.1)); 24 } else { 25 if (1 / (Number.MIN_VALUE / -2.1) !== Number.NEGATIVE_INFINITY) { 26 throw new Test262Error('#2.2: Number.MIN_VALUE / -2.1 === -0. Actual: +0'); 27 } 28 } 29 30 //CHECK#3 31 if (Number.MIN_VALUE / 2.0 !== 0) { 32 throw new Test262Error('#3: Number.MIN_VALUE / 2.0 === 0. Actual: ' + (Number.MIN_VALUE / 2.0)); 33 } 34 35 //CHECK#4 36 if (Number.MIN_VALUE / -2.0 !== -0) { 37 throw new Test262Error('#4.1: Number.MIN_VALUE / -2.0 === -0. Actual: ' + (Number.MIN_VALUE / -2.0)); 38 } else { 39 if (1 / (Number.MIN_VALUE / -2.0) !== Number.NEGATIVE_INFINITY) { 40 throw new Test262Error('#4.2: Number.MIN_VALUE / -2.0 === -0. Actual: +0'); 41 } 42 } 43 44 //CHECK#5 45 if (Number.MIN_VALUE / 1.9 !== Number.MIN_VALUE) { 46 throw new Test262Error('#5: Number.MIN_VALUE / 1.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.9)); 47 } 48 49 //CHECK#6 50 if (Number.MIN_VALUE / -1.9 !== -Number.MIN_VALUE) { 51 throw new Test262Error('#6: Number.MIN_VALUE / -1.9 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.9)); 52 } 53 54 //CHECK#7 55 if (Number.MIN_VALUE / 1.1 !== Number.MIN_VALUE) { 56 throw new Test262Error('#7: Number.MIN_VALUE / 1.1 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.1)); 57 } 58 59 //CHECK#8 60 if (Number.MIN_VALUE / -1.1 !== -Number.MIN_VALUE) { 61 throw new Test262Error('#8: Number.MIN_VALUE / -1.1 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.1)); 62 } 63 64 reportCompare(0, 0);