S11.5.3_A4_T5.js (3870B)
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 a ECMAScript floating-point remainder operation is 7 determined by the rules of IEEE arithmetics 8 es5id: 11.5.3_A4_T5 9 description: > 10 If dividend is finite and the divisor is an infinity, the result 11 equals the dividend 12 ---*/ 13 14 //CHECK#1 15 if (1 % Number.NEGATIVE_INFINITY !== 1) { 16 throw new Test262Error('#1: 1 % -Infinity === 1. Actual: ' + (1 % -Infinity)); 17 } 18 //CHECK#2 19 if (1 % Number.POSITIVE_INFINITY !==1) { 20 throw new Test262Error('#2: 1 % Infinity === 1. Actual: ' + (1 % Infinity)); 21 } 22 23 //CHECK#3 24 if (-1 % Number.POSITIVE_INFINITY !== -1) { 25 throw new Test262Error('#3: -1 % Infinity === -1. Actual: ' + (-1 % Infinity)); 26 } 27 28 //CHECK#4 29 if (-1 % Number.NEGATIVE_INFINITY !== -1) { 30 throw new Test262Error('#4: -1 % -Infinity === -1. Actual: ' + (-1 % -Infinity)); 31 } 32 33 //CHECK#5 34 if (0 % Number.POSITIVE_INFINITY !== 0) { 35 throw new Test262Error('#5.1: 0 % Infinity === 0. Actual: ' + (0 % Infinity)); 36 } else { 37 if (1 / (0 % Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { 38 throw new Test262Error('#5.2: 0 % Infinity === + 0. Actual: -0'); 39 } 40 } 41 42 //CHECK#6 43 if (0 % Number.NEGATIVE_INFINITY !== 0) { 44 throw new Test262Error('#6.1: 0 % -Infinity === 0. Actual: ' + (0 % -Infinity)); 45 } else { 46 if (1 / (0 % Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) { 47 throw new Test262Error('#6.2: 0 % -Infinity === + 0. Actual: -0'); 48 } 49 } 50 51 //CHECK#7 52 if (-0 % Number.POSITIVE_INFINITY !== -0) { 53 throw new Test262Error('#7.1: -0 % Infinity === 0. Actual: ' + (-0 % Infinity)); 54 } else { 55 if (1 / (-0 % Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { 56 throw new Test262Error('#7.2: -0 % Infinity === - 0. Actual: +0'); 57 } 58 } 59 60 //CHECK#8 61 if (-0 % Number.NEGATIVE_INFINITY !== -0) { 62 throw new Test262Error('#8.1: -0 % -Infinity === 0. Actual: ' + (-0 % -Infinity)); 63 } else { 64 if (1 / (-0 % Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { 65 throw new Test262Error('#8.2: -0 % -Infinity === - 0. Actual: +0'); 66 } 67 } 68 69 //CHECK#9 70 if (Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== Number.MAX_VALUE) { 71 throw new Test262Error('#9: Number.MAX_VALUE % -Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % -Infinity)); 72 } 73 74 //CHECK#10 75 if (Number.MAX_VALUE % Number.POSITIVE_INFINITY !== Number.MAX_VALUE) { 76 throw new Test262Error('#10: Number.MAX_VALUE % Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % Infinity)); 77 } 78 79 //CHECK#11 80 if (-Number.MAX_VALUE % Number.POSITIVE_INFINITY !== -Number.MAX_VALUE) { 81 throw new Test262Error('#11: -Number.MAX_VALUE % Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % Infinity)); 82 } 83 84 //CHECK#12 85 if (-Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== -Number.MAX_VALUE) { 86 throw new Test262Error('#12: -Number.MAX_VALUE % -Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % -Infinity)); 87 } 88 89 //CHECK#13 90 if (Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== Number.MIN_VALUE) { 91 throw new Test262Error('#13: Number.MIN_VALUE % -Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % -Infinity)); 92 } 93 //CHECK#14 94 if (Number.MIN_VALUE % Number.POSITIVE_INFINITY !== Number.MIN_VALUE) { 95 throw new Test262Error('#14: Number.MIN_VALUE % Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % Infinity)); 96 } 97 98 //CHECK#15 99 if (-Number.MIN_VALUE % Number.POSITIVE_INFINITY !== -Number.MIN_VALUE) { 100 throw new Test262Error('#15: -Number.MIN_VALUE % Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % Infinity)); 101 } 102 103 //CHECK#16 104 if (-Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== -Number.MIN_VALUE) { 105 throw new Test262Error('#16: -Number.MIN_VALUE % -Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % -Infinity)); 106 } 107 108 reportCompare(0, 0);