| 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 floating-point multiplication is governed by the rules of |
| 7 |
IEEE 754 double-precision arithmetics |
| 8 |
es5id: 11.5.1_A4_T5 |
| 9 |
description: > |
| 10 |
Multiplication of an infinity by a finite non-zero value results |
| 11 |
in a signed infinity |
| 12 |
---*/ |
| 13 |
|
| 14 |
//CHECK#1 |
| 15 |
if (Number.NEGATIVE_INFINITY * -1 !== Number.POSITIVE_INFINITY) { |
| 16 |
throw new Test262Error('#1: -Infinity * -1 === Infinity. Actual: ' + (-Infinity * -1)); |
| 17 |
} |
| 18 |
|
| 19 |
//CHECK#2 |
| 20 |
if (-1 * Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY) { |
| 21 |
throw new Test262Error('#2: -1 * -Infinity === Infinity. Actual: ' + (-1 * -Infinity)); |
| 22 |
} |
| 23 |
|
| 24 |
//CHECK#3 |
| 25 |
if (Number.POSITIVE_INFINITY * -1 !== Number.NEGATIVE_INFINITY) { |
| 26 |
throw new Test262Error('#3: Infinity * -1 === -Infinity. Actual: ' + (Infinity * -1)); |
| 27 |
} |
| 28 |
|
| 29 |
//CHECK#4 |
| 30 |
if (-1 * Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY) { |
| 31 |
throw new Test262Error('#4: -1 * Infinity === -Infinity. Actual: ' + (-1 * Infinity)); |
| 32 |
} |
| 33 |
|
| 34 |
//CHECK#5 |
| 35 |
if (Number.POSITIVE_INFINITY * Number.MAX_VALUE !== Number.POSITIVE_INFINITY) { |
| 36 |
throw new Test262Error('#5: Infinity * Number.MAX_VALUE === Infinity. Actual: ' + (Infinity * Number.MAX_VALUE)); |
| 37 |
} |
| 38 |
|
| 39 |
//CHECK#6 |
| 40 |
if (Number.POSITIVE_INFINITY * Number.MAX_VALUE !== Number.MAX_VALUE * Number.POSITIVE_INFINITY) { |
| 41 |
throw new Test262Error('#6: Infinity * Number.MAX_VALUE === Number.MAX_VALUE * Infinity. Actual: ' + (Infinity * Number.MAX_VALUE)); |
| 42 |
} |
| 43 |
|
| 44 |
//CHECK#7 |
| 45 |
if (Number.NEGATIVE_INFINITY * Number.MIN_VALUE !== Number.NEGATIVE_INFINITY) { |
| 46 |
throw new Test262Error('#7: -Infinity * Number.MIN_VALUE === -Infinity. Actual: ' + (-Infinity * Number.MIN_VALUE)); |
| 47 |
} |
| 48 |
|
| 49 |
//CHECK#8 |
| 50 |
if (Number.NEGATIVE_INFINITY * Number.MIN_VALUE !== Number.MIN_VALUE * Number.NEGATIVE_INFINITY) { |
| 51 |
throw new Test262Error('#8: -Infinity * Number.MIN_VALUE === Number.MIN_VALUE * -Infinity. Actual: ' + (-Infinity * Number.MIN_VALUE)); |
| 52 |
} |
| 53 |
|
| 54 |
reportCompare(0, 0); |