|
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_T7.js |
|
8 * @description If the magnitude is too small to represent, the result is then a zero of appropriate sign |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 if (Number.MIN_VALUE * 0.1 !== 0) { |
|
13 $ERROR('#1: Number.MIN_VALUE * 0.1 === 0. Actual: ' + (Number.MIN_VALUE * 0.1)); |
|
14 } |
|
15 |
|
16 //CHECK#2 |
|
17 if (-0.1 * Number.MIN_VALUE !== -0) { |
|
18 $ERROR('#2.1: -0.1 * Number.MIN_VALUE === -0. Actual: ' + (-0.1 * Number.MIN_VALUE)); |
|
19 } else { |
|
20 if (1 / (-0.1 * Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { |
|
21 $ERROR('#2.2: -0.1 * Number.MIN_VALUE === -0. Actual: +0'); |
|
22 } |
|
23 } |
|
24 |
|
25 //CHECK#3 |
|
26 if (Number.MIN_VALUE * 0.5 !== 0) { |
|
27 $ERROR('#3: Number.MIN_VALUE * 0.5 === 0. Actual: ' + (Number.MIN_VALUE * 0.5)); |
|
28 } |
|
29 |
|
30 //CHECK#4 |
|
31 if (-0.5 * Number.MIN_VALUE !== -0) { |
|
32 $ERROR('#4.1: -0.5 * Number.MIN_VALUE === -0. Actual: ' + (-0.5 * Number.MIN_VALUE)); |
|
33 } else { |
|
34 if (1 / (-0.5 * Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { |
|
35 $ERROR('#4.2: -0.5 * Number.MIN_VALUE === -0. Actual: +0'); |
|
36 } |
|
37 } |
|
38 |
|
39 //CHECK#5 |
|
40 if (Number.MIN_VALUE * 0.51 !== Number.MIN_VALUE) { |
|
41 $ERROR('#5: Number.MIN_VALUE * 0.51 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE * 0.51)); |
|
42 } |
|
43 |
|
44 //CHECK#6 |
|
45 if (-0.51 * Number.MIN_VALUE !== -Number.MIN_VALUE) { |
|
46 $ERROR('#6: -0.51 * Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0.51 * Number.MIN_VALUE)); |
|
47 } |
|
48 |
|
49 //CHECK#7 |
|
50 if (Number.MIN_VALUE * 0.9 !== Number.MIN_VALUE) { |
|
51 $ERROR('#7: Number.MIN_VALUE * 0.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE * 0.9)); |
|
52 } |
|
53 |
|
54 //CHECK#8 |
|
55 if (-0.9 * Number.MIN_VALUE !== -Number.MIN_VALUE) { |
|
56 $ERROR('#8: -0.9 * Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0.9 * Number.MIN_VALUE)); |
|
57 } |
|
58 |