Subject: Re: floating point negative zero
To: None <>
From: Alan Barrett <>
List: tech-userlevel
Date: 08/24/2007 20:14:50
On Fri, 24 Aug 2007, David Laight wrote:
> I believe the current code is correct (but I can't remember why I
> think that!)  ie the difference between +0 and -0 should be visible to
> programs.

Oh, I believe that programs that really care should be able to tell the
difference.  For example, they could use code like this:

	double poszero = 0.0;
	double negzero = -poszero;
	if (copysign(1.0, poszero) != copysign(1.0, negzero) {
		/* signs of poszero and negzero are different */

My questions are more about what should happen to programs that just
want to do some arithmetic and print the results using printf or
similar, without taking special care to differentiate between positive
and negative zero.

--apb (Alan Barrett)