From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29610 invoked by alias); 10 Jun 2011 00:34:00 -0000 Received: (qmail 29601 invoked by uid 22791); 10 Jun 2011 00:33:59 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jun 2011 00:33:44 +0000 From: "ahn567 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/49336] ATAN2 values differ from those specified in documentation X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Keywords: documentation X-Bugzilla-Severity: minor X-Bugzilla-Who: ahn567 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 10 Jun 2011 00:34:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00819.txt.bz2 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.)