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