------- Comment #11 from sgk at troutmask dot apl dot washington dot edu  
2005-11-30 19:24 -------
Subject: Re:  sqrt, csqrt may give a wrong result if real part of compex
argument is zero

On Wed, Nov 30, 2005 at 10:38:13AM -0800, Steve Kargl wrote:
> 
> Your patch is incorrect.  See page 472 of n1124.pdf.
> 
> 3 The functions are continuous onto both sides of their branch
>   cuts, taking into account the sign of zero.  For example,
>   cqrt(2 +- i0) = +- i sqrt(2).   
> 
> In F.8.2, we find 
> 
> -x <--> 0 - x  The expressions -x and 0 - x are not equivalent if x
>                is +0, because -(+0) yields -0, but 0 - (+0) yields
>                +0 (unless rounding is downward).
> 
> I need to look through the Fortran standard to see what it does
> with signed zero.
> 

OK. I found additional info in the Fortran 2003
standard in 1.6.1

(3)   If the processor can distinguish between positive and negative
      real zero, this standard requires different returned values for
      ATAN2(Y,X) when X < 0 and Y is negative real zero and for LOG(X)
      and SQRT(X) when X is complex with REAL(X) < 0 and negative zero
      imaginary part.

Now, I need to determine if unary minus of 0 gives a signed zero


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25017

Reply via email to