[PATCH v4 06/21] math: Remove the SVID error handling from remainderf

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed Oct 29 16:18:35 GMT 2025


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.

       x = fabs (__ieee754_fmodf (x, p + p)); /* now x < 2p */

__fmodf

       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);

Cheers,
Wilco


More information about the Libc-alpha mailing list