js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T2.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     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 floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics
     6  *
     7  * @path ch11/11.5/11.5.1/S11.5.1_A4_T2.js
     8  * @description The sign of the result is positive if both operands have the same sign, negative if the operands have different signs
     9  */
    11 //CHECK#1
    12 if (1 * 1 !== 1) {
    13   $ERROR('#1: 1 * 1 === 1. Actual: ' + (1 * 1));
    14 }
    16 //CHECK#2
    17 if (1 * -1 !== -1) {
    18   $ERROR('#2: 1 * -1 === -1. Actual: ' + (1 * -1));
    19 }
    21 //CHECK#3
    22 if (-1 * 1 !== -1) {
    23   $ERROR('#3: -1 * 1 === -1. Actual: ' + (-1 * 1));
    24 }
    26 //CHECK#4
    27 if (-1 * -1 !== 1) {
    28   $ERROR('#4: -1 * -1 === 1. Actual: ' + (-1 * -1));
    29 }
    31 //CHECK#5
    32 if (0 * 0 !== 0) {
    33   $ERROR('#5.1: 0 * 0 === 0. Actual: ' + (0 * 0));
    34 } else {
    35   if (1 / (0 * 0) !== Number.POSITIVE_INFINITY) {
    36     $ERROR('#5.2: 0 * 0 === + 0. Actual: -0');
    37   }
    38 }
    40 //CHECK#6
    41 if (0 * -0 !== -0) {
    42   $ERROR('#6.1: 0 * -0 === 0. Actual: ' + (0 * -0));
    43 } else {
    44   if (1 / (0 * -0) !== Number.NEGATIVE_INFINITY) {
    45     $ERROR('#6.2: 0 * -0 === - 0. Actual: +0');
    46   }
    47 }
    49 //CHECK#7
    50 if (-0 * 0 !== -0) {
    51   $ERROR('#7.1: -0 * 0 === 0. Actual: ' + (-0 * 0));
    52 } else {
    53   if (1 / (-0 * 0) !== Number.NEGATIVE_INFINITY) {
    54     $ERROR('#7.2: -0 * 0 === - 0. Actual: +0');
    55   }
    56 }
    58 //CHECK#8
    59 if (-0 * -0 !== 0) {
    60   $ERROR('#8.1: -0 * -0 === 0. Actual: ' + (-0 * -0));
    61 } else {
    62   if (1 / (-0 * -0) !== Number.POSITIVE_INFINITY) {
    63     $ERROR('#8.2: 0 * -0 === - 0. Actual: +0');
    64   }
    65 }

mercurial