[PATCH 2/3] math: Optimize dbl-64 remainder implementation

Wilco Dijkstra Wilco.Dijkstra@arm.com
Fri Sep 12 14:46:32 GMT 2025


Hi Adhemerval,

> Yeah, the x * y is need for !LIBM_SVID_COMPAT (and it explains why I was not see
> math failure on x86_64. But, for errno we still use the math/w_remainder_template.c or
> math/w_remainder_compat.c which correctly sets the errno.

Yes, getting rid of the veneers should be a follow-on patch.

> I will add the workload tags on the benchtests, but I don't think we should microoptimize
> this case because the most of time will be spent in fmod function.

Hopefully yes. 

>> -0.0 and 0.0 are the same - it appears GCC optimizes it to x == 0.0, but it's still wrong to
>> write x == -0.0 since it gives the incorrect impression that it excludes 0.0 when it does not....
>
> Even for -frounding-math? If so I think we should keep the integer checks then.

Of course. -0.0 is identical to 0.0 in comparisons in all cases. And no need to differentiate
since it makes no difference. Because of that, there is no point in using integer math since
you don't gain anything.

Cheers,
Wilco


More information about the Libc-alpha mailing list