Debian Codegraph @

js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T7.js

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