On Thu, 3 Jul 2025, Jakub Jelinek wrote: > > Isn't the whole raison d'etre for the trig-pi functions that the internal > > argument reduction against multiples of pi becomes trivial and hence (a) > > performant, and (b) doesn't introduce rounding artifacts? Expressing the > > trig-pi functions in terms of their counterparts completely defeats this > > purpose. The other way around would be more sensible for the cases where > > it works, but the above doesn't seem very attractive.
> x = M_FABS (x - M_LIT (2.0) * M_SUF (round) (M_LIT (0.5) * x)); In particular, this is what trivial range reduction looks like: no need to do multiple-precision multiplication with the relevant bits of a multiple-precision value of 1/pi, just round to the nearest integer (typically a single instruction). -- Joseph S. Myers josmy...@redhat.com