[PATCH 23/25] math: Use erfc from CORE-MATH

Joe Ramsay joe.ramsay@arm.com
Wed Sep 17 10:46:20 GMT 2025


On 17/09/2025 11:25, H. Peter Anvin wrote:
> On September 17, 2025 1:19:54 AM PDT, Andreas Schwab <schwab@suse.de> wrote:
>> On Sep 17 2025, H. Peter Anvin wrote:
>>
>>> I don't know if there is some trick with headers that would let -ffast-math invoke a "fast and sloppy" version?
>>      This option causes the preprocessor macro '__FAST_MATH__' to be
>>      defined.
>>
> So one could involve something like __fast_math_erf in that case ...

Hi,

Something like what you're describing already happens on AArch64 and 
X86_64 in the form of the vector math routines, providing the user has 
sufficiently recent GCC (9 for AArch64, not sure for X86_64). If 
fast-math is enabled then GCC is permitted to transform scalar math 
calls to vector, which may have up to 4 ULP (this works by only making 
GCC aware of the vector variants if __FAST_MATH__ is present). Just 
thought it might be useful to know in case you're not already aware, 
since on these two platforms the mechanism you're suggesting would be 
largely unused except by those with old-ish compilers.

Joe



More information about the Libc-alpha mailing list