**Subject:** Re: floating point negative zero

**To:** Terry Moore *<tmm@mcci.com>*

**From:** David Laight *<david@l8s.co.uk>*

**List:** tech-userlevel

**Date:** 08/25/2007 08:50:11
On Fri, Aug 24, 2007 at 05:19:50PM -0400, Terry Moore wrote:
> According to ISO C-1999 page 275, section 7.19.6.1, note 233:
>
> "The results of all floating conversions of a negative zero, and of
> negative values that round to zero, include a minus sign".
Maybe the word 'round' is intended to be significant ?
so
for (a = -1.0; a != 0.0; a /= 10.0);
would give -0, but
a = -1.0; a *= 0.0;
would generate 0 because there is no rounding error.
Probably
for (a = -1.0; a != 0.0; a /= 10.0);
b = 1.0; b *= a;
is required to generate -0.
David
--
David Laight: david@l8s.co.uk