[PATCH 09/17] math: Use exp10m1f from CORE-MATH

Paul Zimmermann Paul.Zimmermann@inria.fr
Wed Nov 6 11:07:12 GMT 2024


       Hi Florian,

there was a missing 'f' suffix:

--- a/sysdeps/ieee754/flt-32/s_exp10m1f.c
+++ b/sysdeps/ieee754/flt-32/s_exp10m1f.c
@@ -40,7 +40,7 @@ __exp10m1f (float x)
     { /* x < -7.52575 */
       if (ax > (0xffu << 23))
        return x + x; /* nan */
-      return (ux == 0xff800000) ? -0x1p+0 : -0x1p+0 + 0x1p-26f;
+      return (ux == 0xff800000) ? -0x1p+0f : -0x1p+0f + 0x1p-26f;
     }
   else if (__glibc_unlikely (ax > 0x421a209au))
     { /* x > 38.5318 */

The same patch should be applied to exp2m1f.

Paul

> From: Florian Weimer <fweimer@redhat.com>
> Cc: libc-alpha@sourceware.org,  Paul Zimmermann <Paul.Zimmermann@inria.fr>,
>   Alexei Sibidanov <sibid@uvic.ca>
> Date: Wed, 06 Nov 2024 11:29:04 +0100
> 
> * Adhemerval Zanella:
> 
> > The CORE-MATH implementation is correctly rounded (for any rounding mode)
> > and shows better performance compared to the generic exp10m1f.
> 
> When compiled with GCC 11, it's not correctly rounded on x86-64 (both
> current AMD and Intel CPUs, with and without FMA):
> 
> Failure: Test: exp10m1_towardzero (-0x1.1p+4)                                   
> Result:                                                                         
>  is:         -1.00000000e+00  -0x1.000000p+0                                    
>  should be:  -9.99999940e-01  -0x1.fffffep-1                                    
>  difference:  5.96046447e-08   0x1.000000p-24                                   
>  ulp       :  1.0000                                                            
>  max.ulp   :  0.0000                                                            
> 
> I don't see this with GCC 14.
> 
> Any suggestions how to debug this further?
> 
> Thanks,
> Florian
> 


More information about the Libc-alpha mailing list