From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87531 invoked by alias); 28 Sep 2016 18:55:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 87503 invoked by uid 89); 28 Sep 2016 18:55:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Fritz, quality, sind X-Spam-User: qpsmtpd, 2 recipients X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Sep 2016 18:55:36 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id u8SItYgG009943 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 28 Sep 2016 11:55:34 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id u8SItXp8009942; Wed, 28 Sep 2016 11:55:33 -0700 (PDT) (envelope-from sgk) Date: Wed, 28 Sep 2016 19:04:00 -0000 From: Steve Kargl To: Fritz Reese Cc: fortran , gcc-patches Subject: Re: [PATCH, Fortran] Extension: COTAN and degree-valued trig intrinsics with -fdec-math Message-ID: <20160928185533.GA9892@troutmask.apl.washington.edu> Reply-To: kargl@uw.edu References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-SW-Source: 2016-09/txt/msg02180.txt.bz2 On Mon, Sep 26, 2016 at 10:01:27AM -0400, Fritz Reese wrote: > > Attached is a patch extending the GNU Fortran front-end to support > some additional math intrinsics, enabled with a new compile flag > -fdec-math. The flag adds the COTAN intrinsic (cotangent), as well as > degree versions of all trigonometric intrinsics (SIND, TAND, ACOSD, > etc...). This extension allows for further compatibility with legacy > code that depends on the compiler to support such intrinsic functions. > I plan to review this patch over the weekend. Two things to consider. 1) The documentation should note that these intrinsics are for compatibility with legacy code and should strongly discourage their use in new code. 2) In regards to Joseph and Tobias' comments, the documentation should give a hint to the quality of implementation. Argument reduction can be a real pain and without a formal numerical analysis, I can imagine large ULP errors near zeros and infinities. I haven't looked at the implementation yet, but will suggest that REAL(4) should probably be simply written in terms of REAL(8), e.g., function sind(x) result(retval) real(4) retval real(4), intent(in) :: x retval = dsind(real(x, 8)) end function sind Yes, the layer of indirection and computations in REAL(8) will be slower, but you should have much improved accuracy. -- Steve