glibc/sysdeps/ieee754
Sergei Zimmerman 9e51ae3cd0 sysdeps/ieee754: Fix remainder sign of zero for FE_DOWNWARD (BZ #32711)
Single-precision remainderf() and quad-precision remainderl()
implementation derived from Sun is affected by an issue when the result
is +-0. IEEE754 requires that if remainder(x, y) = 0, its sign shall be
that of x regardless of the rounding direction.

The implementation seems to have assumed that x - x = +0 in all
rounding modes, which is not the case. When rounding direction is
roundTowardNegative the sign of an exact zero sum (or difference) is −0.

Regression tests that triggered this erroneous behavior are added to
math/libm-test-remainder.inc.

Tested for cross riscv64 and powerpc.

Original fix by: Bruce Evans <bde@FreeBSD.org> in FreeBSD's
a2ddfa5ea726c56dbf825763ad371c261b89b7c7.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-02-26 17:17:25 -03:00
..
dbl-64 math: Add optimization barrier to ensure a1 + u.d is not reused [BZ #30664] 2025-02-25 15:57:53 -05:00
float128 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
flt-32 sysdeps/ieee754: Fix remainder sign of zero for FE_DOWNWARD (BZ #32711) 2025-02-26 17:17:25 -03:00
ldbl-64-128 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ldbl-96 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ldbl-128 sysdeps/ieee754: Fix remainder sign of zero for FE_DOWNWARD (BZ #32711) 2025-02-26 17:17:25 -03:00
ldbl-128ibm Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ldbl-128ibm-compat Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ldbl-opt Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
soft-fp Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ieee754.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
k_standard.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
k_standardf.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
k_standardl.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libm-alias-finite.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
Makefile Avoid -Wno-write-strings for k_standard.c. 2015-02-26 22:50:54 +00:00
s_lib_version.c Simplify math-svid-compat code. 2017-08-28 15:19:52 +00:00
s_matherr.c Obsolete matherr, _LIB_VERSION, libieee.a. 2017-08-21 17:45:10 +00:00
s_signgam.c Remove unnecessary math_private.h includes. 2018-09-28 21:53:33 +00:00