aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-30 13:45:14 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-09 10:29:18 -0300
commit102f6424791ee49c9600898dc9312ba278a7f8c5 (patch)
treeace4d3044d6b7aeed1b8f399b82d24eddea9ea32
parent55f60dad7faafe3676c8cb926a081d99dc686d6b (diff)
downloadglibc-102f6424791ee49c9600898dc9312ba278a7f8c5.tar
glibc-102f6424791ee49c9600898dc9312ba278a7f8c5.tar.gz
glibc-102f6424791ee49c9600898dc9312ba278a7f8c5.tar.bz2
glibc-102f6424791ee49c9600898dc9312ba278a7f8c5.zip
math: Fix potential underflow on ldbl-128 erfl
The multiplication is only required if the branch is taken, and the compiler might not optimize it away. Checked on aarch64-linux-gnu with gcc and clang.
-rw-r--r--sysdeps/ieee754/ldbl-128/s_erfl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
index 1cbedc249d..e52d88bde3 100644
--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
@@ -778,7 +778,6 @@ __erfl (_Float128 x)
}
u.parts32.w0 = ix;
a = u.value;
- z = x * x;
if (ix < 0x3ffec000) /* a < 0.875 */
{
if (ix < 0x3fc60000) /* |x|<2**-57 */
@@ -792,6 +791,7 @@ __erfl (_Float128 x)
}
return x + efx * x;
}
+ z = x * x;
y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1);
}
else