tor-browser

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

S11.6.2_A4_T5.js (1272B)


      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: Operator x - y produces the same result as x + (-y)
      6 es5id: 11.6.2_A4_T5
      7 description: >
      8    Using the rule of sum of two zeroes and the fact that a - b = a +
      9    (-b)
     10 ---*/
     11 
     12 //CHECK#1
     13 if (-0 - -0 !== 0 ) {  
     14  throw new Test262Error('#1.1: -0 - -0 === 0. Actual: ' + (-0 - -0));
     15 } else {
     16  if (1 / (-0 - -0) !== Number.POSITIVE_INFINITY) {
     17    throw new Test262Error('#1.2: -0 - -0 === + 0. Actual: -0');
     18  }
     19 }
     20 
     21 //CHECK#2
     22 if (0 - -0 !== 0 ) {  
     23  throw new Test262Error('#2.1: 0 - -0 === 0. Actual: ' + (0 - -0));
     24 } else {
     25  if (1 / (0 - -0) !== Number.POSITIVE_INFINITY) {
     26    throw new Test262Error('#2.2: 0 - -0 === + 0. Actual: -0');
     27  }
     28 }
     29 
     30 //CHECK#3
     31 if (-0 - 0 !== -0 ) {  
     32  throw new Test262Error('#3.1: -0 - 0 === 0. Actual: ' + (-0 - 0));
     33 } else {
     34  if (1 / (-0 - 0) !== Number.NEGATIVE_INFINITY) {
     35    throw new Test262Error('#3.2: -0 - 0 === - 0. Actual: +0');
     36  }
     37 }
     38 
     39 //CHECK#4
     40 if (0 - 0 !== 0 ) {  
     41  throw new Test262Error('#4.1: 0 - 0 === 0. Actual: ' + (0 - 0));
     42 } else {
     43  if (1 / (0 - 0) !== Number.POSITIVE_INFINITY) {
     44    throw new Test262Error('#4.2: 0 - 0 === + 0. Actual: -0');
     45  }
     46 }
     47 
     48 reportCompare(0, 0);