Re: math_error.7 draft 3, for review

Andries E. Brouwer
2008-07-21T14:15:15Z

On Mon, Jul 21, 2008 at 01:36:52PM +0200, Michael Kerrisk wrote:
> Hi Andries,
>
> Reading the POSIX.1 specs of various functions, I see that sometimes
> they talk of the return value of a function as being +0, sometimes
> +-0, and sometimes -0. Does one need to care about this?

Yes.

These are different floating point values, and sometimes the
difference is important. In cases of total loss of precision
it is the only bit left. At a branch cut one has a discontinuity
and for example the imaginary part of clog(0.0) will be 0
while the imaginary part of clog(-0.0) is pi*I.

Andries