On Thu, 3 Jul 2025, Michael Matz wrote:

> Yes.  And then the above is multiplied by PI, passed to cos/sin and that 
> one then tries to figure out the multiple of PI (i.e. the 'x' above) again 
> via range reduction (not a _terribly_ slow one anymore in a good 
> implementation, because of the limited input range, but still).  That's 
> backwards.

People are encouraged to contribute format-specific implementations of 
these functions to glibc (for example, from CORE-MATH), after adding 
inputs to the glibc benchmarks so it can be verified if new 
implementations are a performance improvement.  Indeed, that's already 
been done for various functions for binary32 format.  The point of 
type-generic implementations is not to be optimal for performance or 
accuracy but to get the API supported across all glibc configurations 
within a reasonable time (including formats such as IBM long double that 
probably no-one cares enough about to write specific implementations for 
now), so that further improvements can be made incrementally.

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to