Joseph Myers wrote:
On Sun, 1 Jun 2025, Yuao Ma wrote:
For MPFR versions older than 4.2.0, we've included our own folding functions.
I think the normal practice in GCC would be to avoid the optimizations
when the MPFR support is absent, instead of working around the absence
with possibly less accurate implementations.
No real comment, I just dug into the the old commits:
* * *
That seems to be at least the case at the time of the 2008 version bump:
36c713e04cb configure.ac (MPFR check): Bump minimum version to 2.3.0 and
recommended version to 2.3.2.
Albeit the Bessel functions are also not that trivial to implement.
For Fortran, we definitely had newer mpfr besides older for constant
expression simplification (fortran/simplify.cc), albeit I think we
always started with having the own implementation - adding the new MPFR
functions when they became available later on.
For those trigonometric functions, adding a < MPFR 4.2.0 version is
comparably (much) simpler than before, albeit it also has potentially
rounding/special-case issues.
[Fortran also comes with some C99 fallback functions, if libc doesn't
have them, favouring libc, if available →
libgfortran/intrinsics/c99_functions.c; clearly (g)Fortran has a
different philosophy here.]
* * *
BTW: It seems we should update the 'infrastructure' /
./contrib/download_prerequisites for MPFR 4.2.x, now that we start using
it … (Tracked at https://gcc.gnu.org/PR120237)
Tobias