------- Comment #10 from sgk at troutmask dot apl dot washington dot edu 2005-11-30 18:38 ------- Subject: Re: sqrt, csqrt may give a wrong result if real part of compex argument is zero
On Wed, Nov 30, 2005 at 04:17:01PM -0000, harald dot vogt at desy dot de wrote: > > http://www-zeuthen.desy.de/~hvogt/gfortran/configure.ac.diff > http://www-zeuthen.desy.de/~hvogt/gfortran/acinclude.m4.diff > http://www-zeuthen.desy.de/~hvogt/gfortran/configure.diff > http://www-zeuthen.desy.de/~hvogt/gfortran/config.h.in.diff > http://www-zeuthen.desy.de/~hvogt/gfortran/c99_functions.c.diff > 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. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25017