1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T8.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * The result of division is determined by the specification of IEEE 754 arithmetics 1.9 + * 1.10 + * @path ch11/11.5/11.5.2/S11.5.2_A4_T8.js 1.11 + * @description Division of a zero by any non-zero finite value -0 results in zero of appropriate sign 1.12 + */ 1.13 + 1.14 +//CHECK#1 1.15 +if (-0 / 1 !== -0) { 1.16 + $ERROR('#1.1: -0 / 1 === 0. Actual: ' + (-0 / 1)); 1.17 +} else { 1.18 + if (1 / (-0 / 1) !== Number.NEGATIVE_INFINITY) { 1.19 + $ERROR('#1.2: -0 / 1 === - 0. Actual: +0'); 1.20 + } 1.21 +} 1.22 + 1.23 +//CHECK#2 1.24 +if (-0 / -1 !== +0) { 1.25 + $ERROR('#2.1: -0 / -1 === 0. Actual: ' + (-0 / -1)); 1.26 +} else { 1.27 + if (1 / (-0 / -1) !== Number.POSITIVE_INFINITY) { 1.28 + $ERROR('#2.2: -0 / -1 === + 0. Actual: -0'); 1.29 + } 1.30 +} 1.31 + 1.32 +//CHECK#3 1.33 +if (+0 / 1 !== +0) { 1.34 + $ERROR('#3.1: +0 / 1 === 0. Actual: ' + (+0 / 1)); 1.35 +} else { 1.36 + if (1 / (+0 / -1) !== Number.NEGATIVE_INFINITY) { 1.37 + $ERROR('#3.2: +0 / -1 === + 0. Actual: -0'); 1.38 + } 1.39 +} 1.40 + 1.41 +//CHECK#4 1.42 +if (+0 / -1 !== -0) { 1.43 + $ERROR('#4.1: +0 / -1 === 0. Actual: ' + (+0 / -1)); 1.44 +} else { 1.45 + if (1 / (+0 / -1) !== Number.NEGATIVE_INFINITY) { 1.46 + $ERROR('#4.2: +0 / -1 === - 0. Actual: +0'); 1.47 + } 1.48 +} 1.49 + 1.50 +//CHECK#5 1.51 +if (+0 / -Number.MAX_VALUE !== -0) { 1.52 + $ERROR('#5.1: 0 / -Number.MAX_VALUE === 0. Actual: ' + (0 / -Number.MAX_VALUE)); 1.53 +} else { 1.54 + if (1 / (+0 / -Number.MAX_VALUE) !== Number.NEGATIVE_INFINITY) { 1.55 + $ERROR('#5.2: +0 / -Number.MAX_VALUE === - 0. Actual: +0'); 1.56 + } 1.57 +} 1.58 + 1.59 +//CHECK#6 1.60 +if (-0 / Number.MIN_VALUE !== -0) { 1.61 + $ERROR('#6.1: -0 / Number.MIN_VALUE === 0. Actual: ' + (-0 / Number.MIN_VALUE)); 1.62 +} else { 1.63 + if (1 / (-0 / Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { 1.64 + $ERROR('#6.2: -0 / Number.MIN_VALUE === - 0. Actual: +0'); 1.65 + } 1.66 +} 1.67 +