|
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 division is determined by the specification of IEEE 754 arithmetics |
|
6 * |
|
7 * @path ch11/11.5/11.5.2/S11.5.2_A4_T10.js |
|
8 * @description If both operands are finite and nonzero, the quotient is computed and rounded using IEEE 754 round-to-nearest mode. |
|
9 * If the magnitude is too small to represent, the result is then a zero of appropriate sign |
|
10 */ |
|
11 |
|
12 //CHECK#1 |
|
13 if (Number.MIN_VALUE / 2.1 !== 0) { |
|
14 $ERROR('#1: Number.MIN_VALUE / 2.1 === 0. Actual: ' + (Number.MIN_VALUE / 2.1)); |
|
15 } |
|
16 |
|
17 //CHECK#2 |
|
18 if (Number.MIN_VALUE / -2.1 !== -0) { |
|
19 $ERROR('#2.1: Number.MIN_VALUE / -2.1 === 0. Actual: ' + (Number.MIN_VALUE / -2.1)); |
|
20 } else { |
|
21 if (1 / (Number.MIN_VALUE / -2.1) !== Number.NEGATIVE_INFINITY) { |
|
22 $ERROR('#2.2: Number.MIN_VALUE / -2.1 === -0. Actual: +0'); |
|
23 } |
|
24 } |
|
25 |
|
26 //CHECK#3 |
|
27 if (Number.MIN_VALUE / 2.0 !== 0) { |
|
28 $ERROR('#3: Number.MIN_VALUE / 2.0 === 0. Actual: ' + (Number.MIN_VALUE / 2.0)); |
|
29 } |
|
30 |
|
31 //CHECK#4 |
|
32 if (Number.MIN_VALUE / -2.0 !== -0) { |
|
33 $ERROR('#4.1: Number.MIN_VALUE / -2.0 === -0. Actual: ' + (Number.MIN_VALUE / -2.0)); |
|
34 } else { |
|
35 if (1 / (Number.MIN_VALUE / -2.0) !== Number.NEGATIVE_INFINITY) { |
|
36 $ERROR('#4.2: Number.MIN_VALUE / -2.0 === -0. Actual: +0'); |
|
37 } |
|
38 } |
|
39 |
|
40 //CHECK#5 |
|
41 if (Number.MIN_VALUE / 1.9 !== Number.MIN_VALUE) { |
|
42 $ERROR('#5: Number.MIN_VALUE / 1.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.9)); |
|
43 } |
|
44 |
|
45 //CHECK#6 |
|
46 if (Number.MIN_VALUE / -1.9 !== -Number.MIN_VALUE) { |
|
47 $ERROR('#6: Number.MIN_VALUE / -1.9 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.9)); |
|
48 } |
|
49 |
|
50 //CHECK#7 |
|
51 if (Number.MIN_VALUE / 1.1 !== Number.MIN_VALUE) { |
|
52 $ERROR('#7: Number.MIN_VALUE / 1.1 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.1)); |
|
53 } |
|
54 |
|
55 //CHECK#8 |
|
56 if (Number.MIN_VALUE / -1.1 !== -Number.MIN_VALUE) { |
|
57 $ERROR('#8: Number.MIN_VALUE / -1.1 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.1)); |
|
58 } |
|
59 |