tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S11.5.3_A4_T6.js (2558B)


      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_T6
      9 description: >
     10    If dividend is a zero and the divisor is nonzero finite, the
     11    result equals the dividend
     12 ---*/
     13 
     14 //CHECK#1
     15 if (0 % 1 !== 0) {
     16  throw new Test262Error('#1.1: 0 % 1 === 0. Actual: ' + (0 % 1));
     17 } else {
     18  if (1 / (0 % 1) !== Number.POSITIVE_INFINITY) {
     19    throw new Test262Error('#1.2: 0 % 1 === + 0. Actual: -0');
     20  }
     21 }
     22 
     23 //CHECK#2
     24 if (0 % -1 !== 0) {
     25  throw new Test262Error('#2.1: 0 % -1 === 0. Actual: ' + (0 % -1));
     26 } else {
     27  if (1 / (0 %  -1) !== Number.POSITIVE_INFINITY) {
     28    throw new Test262Error('#2.2: 0 % -1 === + 0. Actual: -0');
     29  }
     30 }
     31 
     32 //CHECK#3
     33 if (-0 % 1 !== -0) {
     34  throw new Test262Error('#3.1: -0 % 1 === 0. Actual: ' + (-0 % 1));
     35 } else {
     36  if (1 / (-0 % 1) !== Number.NEGATIVE_INFINITY) {
     37    throw new Test262Error('#3.2: -0 % 1 === - 0. Actual: +0');
     38  }
     39 }
     40 
     41 //CHECK#4
     42 if (-0 %  -1 !== -0) {
     43  throw new Test262Error('#4.1: -0 % -1 === 0. Actual: ' + (-0 % -1));
     44 } else {
     45  if (1 / (-0 %  -1) !== Number.NEGATIVE_INFINITY) {
     46    throw new Test262Error('#4.2: 0 % -1 === - 0. Actual: +0');
     47  }
     48 }
     49 
     50 //CHECK#5
     51 if (0 % Number.MAX_VALUE !== 0) {
     52  throw new Test262Error('#5.1: 0 % Number.MAX_VALUE === 0. Actual: ' + (0 % Number.MAX_VALUE));
     53 } else {
     54  if (1 / (0 % Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) {
     55    throw new Test262Error('#5.2: 0 % Number.MAX_VALUE === + 0. Actual: -0');
     56  }
     57 }
     58 
     59 //CHECK#6
     60 if (0 % Number.MIN_VALUE !== 0) {
     61  throw new Test262Error('#6.1: 0 % Number.MIN_VALUE === 0. Actual: ' + (0 % Number.MIN_VALUE));
     62 } else {
     63  if (1 / (0 % Number.MIN_VALUE) !== Number.POSITIVE_INFINITY) {
     64    throw new Test262Error('#6.2: 0 % Number.MIN_VALUE === + 0. Actual: -0');
     65  }
     66 }
     67 
     68 //CHECK#7
     69 if (-0 % Number.MAX_VALUE !== -0) {
     70  throw new Test262Error('#7.1: -0 % Number.MAX_VALUE === 0. Actual: ' + (-0 % Number.MAX_VALUE));
     71 } else {
     72  if (1 / (-0 % Number.MAX_VALUE) !== Number.NEGATIVE_INFINITY) {
     73    throw new Test262Error('#7.2: -0 % Number.MAX_VALUE === - 0. Actual: +0');
     74  }
     75 }
     76 
     77 //CHECK#8
     78 if (-0 % Number.MIN_VALUE !== -0) {
     79  throw new Test262Error('#8.1: -0 % Number.MIN_VALUE === 0. Actual: ' + (-0 % Number.MIN_VALUE));
     80 } else {
     81  if (1 / (-0 % Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) {
     82    throw new Test262Error('#8.2: 0 % Number.MIN_VALUE === - 0. Actual: +0');
     83  }
     84 }
     85 
     86 reportCompare(0, 0);