Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics
6 *
7 * @path ch11/11.5/11.5.3/S11.5.3_A4_T5.js
8 * @description If dividend is finite and the divisor is an infinity, the result equals the dividend
9 */
11 //CHECK#1
12 if (1 % Number.NEGATIVE_INFINITY !== 1) {
13 $ERROR('#1: 1 % -Infinity === 1. Actual: ' + (1 % -Infinity));
14 }
15 //CHECK#2
16 if (1 % Number.POSITIVE_INFINITY !==1) {
17 $ERROR('#2: 1 % Infinity === 1. Actual: ' + (1 % Infinity));
18 }
20 //CHECK#3
21 if (-1 % Number.POSITIVE_INFINITY !== -1) {
22 $ERROR('#3: -1 % Infinity === -1. Actual: ' + (-1 % Infinity));
23 }
25 //CHECK#4
26 if (-1 % Number.NEGATIVE_INFINITY !== -1) {
27 $ERROR('#4: -1 % -Infinity === -1. Actual: ' + (-1 % -Infinity));
28 }
30 //CHECK#5
31 if (0 % Number.POSITIVE_INFINITY !== 0) {
32 $ERROR('#5.1: 0 % Infinity === 0. Actual: ' + (0 % Infinity));
33 } else {
34 if (1 / (0 % Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) {
35 $ERROR('#5.2: 0 % Infinity === + 0. Actual: -0');
36 }
37 }
39 //CHECK#6
40 if (0 % Number.NEGATIVE_INFINITY !== 0) {
41 $ERROR('#6.1: 0 % -Infinity === 0. Actual: ' + (0 % -Infinity));
42 } else {
43 if (1 / (0 % Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) {
44 $ERROR('#6.2: 0 % -Infinity === + 0. Actual: -0');
45 }
46 }
48 //CHECK#7
49 if (-0 % Number.POSITIVE_INFINITY !== -0) {
50 $ERROR('#7.1: -0 % Infinity === 0. Actual: ' + (-0 % Infinity));
51 } else {
52 if (1 / (-0 % Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) {
53 $ERROR('#7.2: -0 % Infinity === - 0. Actual: +0');
54 }
55 }
57 //CHECK#8
58 if (-0 % Number.NEGATIVE_INFINITY !== -0) {
59 $ERROR('#8.1: -0 % -Infinity === 0. Actual: ' + (-0 % -Infinity));
60 } else {
61 if (1 / (-0 % Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) {
62 $ERROR('#8.2: -0 % -Infinity === - 0. Actual: +0');
63 }
64 }
66 //CHECK#9
67 if (Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== Number.MAX_VALUE) {
68 $ERROR('#9: Number.MAX_VALUE % -Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % -Infinity));
69 }
71 //CHECK#10
72 if (Number.MAX_VALUE % Number.POSITIVE_INFINITY !== Number.MAX_VALUE) {
73 $ERROR('#10: Number.MAX_VALUE % Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % Infinity));
74 }
76 //CHECK#11
77 if (-Number.MAX_VALUE % Number.POSITIVE_INFINITY !== -Number.MAX_VALUE) {
78 $ERROR('#11: -Number.MAX_VALUE % Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % Infinity));
79 }
81 //CHECK#12
82 if (-Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== -Number.MAX_VALUE) {
83 $ERROR('#12: -Number.MAX_VALUE % -Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % -Infinity));
84 }
86 //CHECK#13
87 if (Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== Number.MIN_VALUE) {
88 $ERROR('#13: Number.MIN_VALUE % -Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % -Infinity));
89 }
90 //CHECK#14
91 if (Number.MIN_VALUE % Number.POSITIVE_INFINITY !== Number.MIN_VALUE) {
92 $ERROR('#14: Number.MIN_VALUE % Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % Infinity));
93 }
95 //CHECK#15
96 if (-Number.MIN_VALUE % Number.POSITIVE_INFINITY !== -Number.MIN_VALUE) {
97 $ERROR('#15: -Number.MIN_VALUE % Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % Infinity));
98 }
100 //CHECK#16
101 if (-Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== -Number.MIN_VALUE) {
102 $ERROR('#16: -Number.MIN_VALUE % -Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % -Infinity));
103 }