[PATCH] sysdeps/ieee754/flt-32: Fix remainderf() sign of zero for FE_DOWNWARD

Andreas Schwab schwab@suse.de
Mon Feb 17 10:05:49 GMT 2025


On Feb 17 2025, Sergei Zimmerman wrote:

> diff --git a/sysdeps/ieee754/flt-32/e_remainderf.c b/sysdeps/ieee754/flt-32/e_remainderf.c
> index 81781363af..7d773ab36d 100644
> --- a/sysdeps/ieee754/flt-32/e_remainderf.c
> +++ b/sysdeps/ieee754/flt-32/e_remainderf.c
> @@ -56,6 +56,9 @@ __ieee754_remainderf(float x, float p)
>  	    }
>  	}
>  	GET_FLOAT_WORD(hx,x);
> +	/* Make sure x is not -0. This can occur only when x = p
> +	   and rounding direction is towards negative infinity. */
> +	if ((hx&0x7fffffff)==0) hx = 0;

Why would that be preferrable to (hx == 0x80000000)?

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list