Admittedly, this *PING* is rather early – but as more trigonometric
functions changes are coming, I think it would be useful to agree
that this is a good approach.
And the patch is simple.
BTW: For the infrastructure/download update,
I have filed https://gcc.gnu.org/PR120237
Next would be the sinpi etc. functions,
cf. https://gcc.gnu.org/PR113152 for Fortran and
https://gcc.gnu.org/PR118592 for C23/middle end.
Tobias Burnus wrote:
C23 added the sinpi, cospi, etc. functions. Therefore, MPFR in 4.2.0
added the mpfr_ counter parts. I assume that those internally use the
mpfr_sinu, mpfr_cosu, ... functions, which are also user accessible.
In any case, MPFR makes the ...u functions available and explicitly
documents that for u = 360, the mpfr_...u functions permits to use
angles in degree instead of rad.
Fortran 2023 added degree trigonometric functions, which gfortran already
supports. Thus:
The attach patch switches to the mpfr_...u functions for the degree
variant if MPFR 4.2.0, but keeps the fallback for older MPFR versions.
[Currently, GCC requires MPFR 3.1 or newer for build. (MPFR 4.2.0 was
releasedJanuary 2023.) We already did likewise in the past: Making
conditionally use of newer MPFR functions, if available, but have a
fallback until the minimal MPFR version is increased. (The last such
code was removed 2008 as then MPFR >= 3.1.0 was the new minimal
version and all of MPFR is currently used unconditionally.)]
Bootstrapped and regtested on x86_64-gnu-linux with MPFR 4.2.2 (the
latest).
OK for mainline?
Tobias
PS: I see gfortran.dg/specifics_1.f90 fails for -O2 and higher, but not
due to this patch → https://gcc.gnu.org/PR120099 (opened on Apr 2025)