[PATCH v5 3/7] math: Remove the SVID error handling from lgammaf/lgammaf_r
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Tue Nov 4 15:36:58 GMT 2025
On 31/10/25 16:04, Wilco Dijkstra wrote:
> Hi Adhemerval,
>
> float
> -__ieee754_lgammaf_r (float x, int *signgamp)
> +__lgammaf_r (float x, int *signgamp)
> {
> static const struct
> {
> @@ -161,7 +163,7 @@ __ieee754_lgammaf_r (float x, int *signgamp)
> if (x <= 0.0f)
> {
> *signgamp = asuint (x) >> 31 ? -1 : 1;
> - return 1.0f / 0.0f;
> + return __math_divzerof (0);
> }
> if (x == 1.0f || x == 2.0f)
> {
> @@ -206,7 +208,8 @@ __ieee754_lgammaf_r (float x, int *signgamp)
> if (ax > 0x1.afc1ap+1f)
> {
> if (__glibc_unlikely (x > 0x1.895f1cp+121f))
> - return math_narrow_eval (0x1p127f * 0x1p127f);
> + return __math_oflowf (0);
> +
> /* |x|>=2**23, must be -integer */
> if (__glibc_unlikely (x < 0.0f && ax > 0x1p+23f))
> return ax / 0.0f;
>
> This also looks like a pole error and should do __math_divzerof (1);
>
> And there is another case that is not handled yet:
>
> if (x < 0.0f)
> {
> int ni = floorf (-2 * x);
> if ((ni & 1) == 0 && ni == -2 * x)
> return 1.0f / 0.0f;
> }
Ack.
>
> +attribute_hidden float
> +__math_oflowf_value (float x)
> +{
> + return with_errnof (x, ERANGE);
> +}
>
> This is no longer needed.
>
> Cheers,
> Wilco
More information about the Libc-alpha
mailing list