public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/112873] F2023 degree trig functions
Date: Thu, 07 Dec 2023 20:42:28 +0000	[thread overview]
Message-ID: <bug-112873-4-bnVgeH2Usz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112873-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112873

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Dec 07, 2023 at 07:59:25PM +0000, anlauf at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112873
> 
> --- Comment #6 from anlauf at gcc dot gnu.org ---
> (In reply to Steve Kargl from comment #5)
> > On Wed, Dec 06, 2023 at 09:58:18PM +0000, anlauf at gcc dot gnu.org wrote:
> > > In your experience, how good (or bad) is a naive inline version
> > > like we do for the degree versions?
> > 
> > It would be possible to use a naive version, but it will
> > likely not approach the requirements placed on these functions
> > by at least the IEEE 754 and C23 standards.
> 
> I see.  The naive version would have done only range reduction and scaling,
> maybe good enough for F2023 ("SINPI (X) is approximately equal to SIN (X×π)")
> but not more.
> 
> Also, one needs mpfr-4.2.0 or higher for simple simplification, or do more
> work.

Correct. A newer version of MPFR contains these functions.  In fact,
the MPFR developer and I cross-checked each other.  We can probably
use a naive implementation with high precision if an older MPFR is
used.

> > I think gfortran
> > should test with configure for these functions in libm and
> > use those if available (e.g., HAVE_COSPI, etc).  In libgfortran,
> > we'll need fallbacks if not available.  To see the complexity
> > of the implementation details see
> > 
> > https://cgit.freebsd.org/src/tree/lib/msun/src/s_cospi.c
> > 
> > Header files defining computation kernels and these use
> > the computation kernels for sin() and cos() from fdlibm.
> > 
> > https://cgit.freebsd.org/src/tree/lib/msun/src/k_cospi.h
> > https://cgit.freebsd.org/src/tree/lib/msun/src/k_sinpi.h
> > 
> > Note, AFAIK, glibc does not implement these functions.
> 
> Right.
> 
> Would you like to open a separate PR for dealing with the half-cycle
> trigonometric functions?

Yes, I'll add a new PR for the half-cycle functions, and 
point to here for the initial discussion.

  parent reply	other threads:[~2023-12-07 20:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 23:16 [Bug fortran/112873] New: " kargl at gcc dot gnu.org
2023-12-05 23:18 ` [Bug fortran/112873] " kargl at gcc dot gnu.org
2023-12-05 23:18 ` kargl at gcc dot gnu.org
2023-12-06 20:56 ` anlauf at gcc dot gnu.org
2023-12-06 21:17 ` sgk at troutmask dot apl.washington.edu
2023-12-06 21:58 ` anlauf at gcc dot gnu.org
2023-12-07 18:26 ` sgk at troutmask dot apl.washington.edu
2023-12-07 19:59 ` anlauf at gcc dot gnu.org
2023-12-07 20:42 ` sgk at troutmask dot apl.washington.edu [this message]
2023-12-09  1:32 ` kargl at gcc dot gnu.org
2023-12-09  1:33 ` kargl at gcc dot gnu.org
2023-12-10 21:45 ` anlauf at gcc dot gnu.org
2023-12-11  2:46 ` sgk at troutmask dot apl.washington.edu
2023-12-11 19:34 ` anlauf at gcc dot gnu.org
2023-12-11 19:53 ` jvdelisle at gcc dot gnu.org
2023-12-11 20:04 ` anlauf at gcc dot gnu.org
2023-12-11 21:00 ` sgk at troutmask dot apl.washington.edu
2023-12-13 17:36 ` jvdelisle at gcc dot gnu.org
2023-12-13 18:43 ` sgk at troutmask dot apl.washington.edu
2023-12-14 17:03 ` jvdelisle at gcc dot gnu.org
2023-12-14 17:15 ` sgk at troutmask dot apl.washington.edu
2023-12-14 17:42 ` anlauf at gcc dot gnu.org
2023-12-14 18:37 ` cvs-commit at gcc dot gnu.org
2023-12-14 19:11 ` jvdelisle at gcc dot gnu.org
2023-12-14 19:31 ` jvdelisle at gcc dot gnu.org
2023-12-14 19:48 ` anlauf at gcc dot gnu.org
2023-12-14 20:04 ` sgk at troutmask dot apl.washington.edu
2023-12-14 20:16 ` jvdelisle at gcc dot gnu.org
2023-12-14 20:35 ` jvdelisle at gcc dot gnu.org
2023-12-14 20:44 ` sgk at troutmask dot apl.washington.edu
2023-12-14 21:46 ` jvdelisle at gcc dot gnu.org
2023-12-14 22:09 ` anlauf at gcc dot gnu.org
2023-12-15  3:04 ` jvdelisle at gcc dot gnu.org
2023-12-15 21:11 ` jvdelisle at gcc dot gnu.org
2023-12-15 21:41 ` anlauf at gcc dot gnu.org
2023-12-16  0:44 ` jvdelisle at gcc dot gnu.org

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=bug-112873-4-bnVgeH2Usz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).