From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 14647383556F; Wed, 7 Dec 2022 22:31:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14647383556F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670452317; bh=Lt6w9EFjX2Ieu+CckTPhuCe9TqARYf1v914WPjJFsF4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hFt55kU/Zn9LKhSI/UXxNtvMIOUqGjsRmVNydT/eP6FVJ0709ZVNN400O0fzzJ2Uk lg9c/QrR2CHQmeb6SgU0BvO6lCnismVfgExqgZPEzQGicHCtz4e4eyLeA/3NNHFK0M etDR77li3KfuzrNXCWCzh3uBnAmsrLdsqaLNFCRU= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107753] gfortran returns NaN in complex divisions (x+x*I)/(x+x*I) and (x+x*I)/(x-x*I) Date: Wed, 07 Dec 2022 22:31:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107753 --- Comment #15 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #14) > Comment #10 contains a simple timing measurement in from my Intel Core2 D= uo > based system. gfortran with its current method (ie., -fcx-fortran-rules) > takes 44.5 clock ticks for a complex division. [...] > ticks. I haven't looked at what algorithm C uses, but I suspect its along > the lines you suggest. I may have misread the library implementation of complex division (libgcc2), but it likely does really much more that we need for Fortran. And some of the overhead seems to come from doing many more divisions in the library version than in the current gfortran variant. > The question is likely do we break backwards > compatibility and remove -fcx-fortran-rules or change when/how > -fcx-fortran-rules applies (e.g., add it to -ffast-math?) I would certainly not be happy breaking backwards compatibility, but is there a precise definition of what the "cx-fortran-rules" are? I had the silent hope that manipulating exponents of IEEE floats could be a cheap operation, allowing for a cheaper solution than the expensive method that gets really borderline cases better, although an unreasonable cost.=