michael@0: function test(i) { michael@0: return i * 0 + 0; michael@0: } michael@0: michael@0: for(var i=0; i<100; i++){ michael@0: var x = test(-i); michael@0: assertEq((x===0 && (1/x)===-Infinity), false); // value should be 0, not -0 michael@0: } michael@0: michael@0: function test2(i) { michael@0: return 0 - i; michael@0: } michael@0: michael@0: for(var i=-100; i<100; i++){ michael@0: var x = test2(-i); michael@0: assertEq(x, i); michael@0: } michael@0: