[PATCH v4 06/21] math: Remove the SVID error handling from remainderf
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Fri Oct 31 12:46:30 GMT 2025
On 29/10/25 13:18, Wilco Dijkstra wrote:
> Hi Adhemerval,
>
> Same comments as for remainder:
>
> if (__glibc_unlikely (hx >= EXPONENT_MASK))
> - return (x * p) / (x * p);
> + return __math_invalidf (x);
>
> If is redundant.
As for remainder, I had to keep it to avoid a 'isnan' check after
the fmod operation to avoid FE_INVALID if 'x' is NaN.
>
> x = fabs (__ieee754_fmodf (x, p + p)); /* now x < 2p */
>
> __fmodf
Ack.
>
> if (x + x > p)
> @@ -53,8 +55,12 @@ __ieee754_remainderf(float x, float p)
> else
> {
> /* |x| not finite or |y| is NaN or 0 */
> - if ((hx >= EXPONENT_MASK || (hp - 1) >= EXPONENT_MASK))
> - return (x * p) / (x * p);
> + if (__glibc_unlikely (hx >= EXPONENT_MASK || (hp - 1) >= EXPONENT_MASK))
> + {
> + if (__glibc_unlikely (is_inf (hp)))
> + return __math_invalidf (x);
> + return (x * p) / (x * p);
> + }
>
> Should be:
>
> if (__glibc_unlikely (hx >= EXPONENT_MASK || hp > EXPONENT_MASK))
> return __math_invalidf (x * p);
Ack.
>
> Cheers,
> Wilco
More information about the Libc-alpha
mailing list