From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11320 invoked by alias); 22 Jun 2013 17:29:58 -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 Received: (qmail 11286 invoked by uid 55); 22 Jun 2013 17:29:55 -0000 From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/57675] Complex division of NaN by zero not handled correctly Date: Sat, 22 Jun 2013 17:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery 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-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg01228.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57675 --- Comment #2 from joseph at codesourcery dot com --- N1399 has a detailed analysis of issues with complex multiply and divide in C99. There was no consensus to adopt requirements in that detail, but N1496 was adopted with a more minimal fix for (1.0+1.0*I)/(0.0+NAN*I). It appears that the GCC implementation does not suffer the particular issue being addressed in N1496. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1399.txt http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1496.htm I believe the model in N1399 (and more generally for NaNs in C99/C11 and the draft TS 18661 bindings to IEEE 754-2008; see e.g. how hypot(NaN, Inf) works) is that NaN+1.0i is considered (for a quiet NaN) to be +1.0i. Dividing by zero then gives an unspecified (or not fully specified) infinity, so a result with one part infinity and one part NaN seems appropriate.