public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Fritz Reese <fritzoreese@gmail.com>
Cc: fortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, Fortran] Extension: COTAN and degree-valued trig intrinsics with -fdec-math
Date: Wed, 28 Sep 2016 19:04:00 -0000	[thread overview]
Message-ID: <20160928185533.GA9892@troutmask.apl.washington.edu> (raw)
In-Reply-To: <CAE4aFAmL5Shx7rKt1fuCF9vXZtTGy_8VNd38NfCYzuPp69tHXA@mail.gmail.com>

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

  parent reply	other threads:[~2016-09-28 18:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 14:20 Fritz Reese
2016-09-26 19:08 ` Toon Moene
2016-09-28 19:04 ` Steve Kargl [this message]
2016-09-26 16:11 Tobias Burnus
2016-09-27 11:06 ` Fritz Reese
2016-09-28  1:12 ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160928185533.GA9892@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=fortran@gcc.gnu.org \
    --cc=fritzoreese@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kargl@uw.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).