|
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 * 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_T1.1.js |
|
8 * @description If left operand is NaN, the result is NaN |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 if (isNaN(Number.NaN * Number.NaN) !== true) { |
|
13 $ERROR('#1: NaN * NaN === Not-a-Number. Actual: ' + (NaN * NaN)); |
|
14 } |
|
15 |
|
16 //CHECK#2 |
|
17 if (isNaN(Number.NaN * +0) !== true) { |
|
18 $ERROR('#2: NaN * +0 === Not-a-Number. Actual: ' + (NaN * +0)); |
|
19 } |
|
20 |
|
21 //CHECK#3 |
|
22 if (isNaN(Number.NaN * -0) !== true) { |
|
23 $ERROR('#3: NaN * -0 === Not-a-Number. Actual: ' + (NaN * -0)); |
|
24 } |
|
25 |
|
26 //CHECK#4 |
|
27 if (isNaN(Number.NaN * Number.POSITIVE_INFINITY) !== true) { |
|
28 $ERROR('#4: NaN * Infinity === Not-a-Number. Actual: ' + (NaN * Infinity)); |
|
29 } |
|
30 |
|
31 //CHECK#5 |
|
32 if (isNaN(Number.NaN * Number.NEGATIVE_INFINITY) !== true) { |
|
33 $ERROR('#5: NaN * -Infinity === Not-a-Number. Actual: ' + (NaN * -Infinity)); |
|
34 } |
|
35 |
|
36 //CHECK#6 |
|
37 if (isNaN(Number.NaN * Number.MAX_VALUE) !== true) { |
|
38 $ERROR('#6: NaN * Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN * Number.MAX_VALUE)); |
|
39 } |
|
40 |
|
41 //CHECK#7 |
|
42 if (isNaN(Number.NaN * Number.MIN_VALUE) !== true) { |
|
43 $ERROR('#7: NaN * Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN * Number.MIN_VALUE)); |
|
44 } |
|
45 |
|
46 //CHECK#8 |
|
47 if (isNaN(Number.NaN * 1) !== true) { |
|
48 $ERROR('#8: NaN * 1 === Not-a-Number. Actual: ' + (NaN * 1)); |
|
49 } |
|
50 |