[PATCH v5 6/7] math: Remove the SVID error handling from tgammaf
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Fri Oct 31 18:29:58 GMT 2025
Hi Adhemerval,
> It improves latency for about 1.5% and throughput for about 2-4%.
@@ -89,30 +82,32 @@ __ieee754_gammaf_r (float x, int *signgamp)
* z - 0x1.2788cfc6fb619p-1;
double f = 1.0 / z + d;
float r = f;
+
uint64_t rt = asuint64 (f);
if (((rt + 2) & 0xfffffff) < 4)
{
- for (unsigned i = 0; i < sizeof (tb) / sizeof (tb[0]); i++)
+ for (unsigned i = 0; i < array_length (tb); i++)
if (t == tb[i].u)
- return tb[i].f + tb[i].df;
+ {
+ r = tb[i].f + tb[i].df;
+ break;
+ }
It's not clear it is useful to assume the table has entries that can
overflow since it is fixed (and we know it doesn't).
}
+ if (isinf (r))
+ errno = ERANGE;
+
return r;
That's just:
if (isinf (r)) return __math_oflowf (t >> 31);
Cheers,
Wilco
More information about the Libc-alpha
mailing list