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-04-17 16:12:41 -0300
commit3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21 (patch)
tree49e44ed4dc3f30f0f4f71412023f3156b298d40e
parentae79f00a76b53d276ff27e9097db1186590a068c (diff)
downloadglibc-3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21.zip
glibc-3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21.tar.gz
glibc-3199b1cc5b9f2ca0714b803b66f4a24e0fa2aa21.tar.bz2
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 1cbedc2..e52d88b 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