This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/49336] ATAN2 values differ from those specified in documentation
- From: "ahn567 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jun 2011 00:33:43 +0000
- Subject: [Bug libfortran/49336] ATAN2 values differ from those specified in documentation
- Auto-submitted: auto-generated
- References: <bug-49336-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49336
--- Comment #3 from ahn567 at gmail dot com 2011-06-10 00:33:41 UTC ---
(In reply to comment #2)
> ahn567: Do you rely on atan (+/-0, x< 0) returning PI instead of -PI? If it is
> really needed, on could add a special handling for -fno-signed-zeros. However,
> that would be slower - and other compilers also follow IEEE/POSIX/F2003 - even
> if they do not print signed zeros by default. Hence, I would prefer to just
> update the gfortran documentation.
No, I do not rely on this. I was just surprised that the following program
would ever output "T F"
program main
double precision :: y1, y2
y1 = +0d0
y2 = -0d0
write(*,*) y1==y2, atan2(y1,-1d0)==atan2(y2,-1d0)
end program
The output is "T F" for both of these compilation commands,
gfortran prog.f90
gfortran -std=f95 prog.f90
Apparently this is correct standard Fortran behaviour, eg. according to
ISO/IEC JTC 1/SC 22/WG 5/N1826.
I had not come across signed zero before. For anyone interested...
http://en.wikipedia.org/wiki/Signed_zero
Updating the gfortran documentation would seem to be the proper thing to do
eg., as per page 331 of the above standard. (The docs for SQRT, SIGN, LOG,...
might also need checking.)