mirror of
https://sourceware.org/git/glibc.git
synced 2026-10-24 01:33:52 +03:00
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. If fixes the following issues when testcase is built with clang: FAIL: math/test-ldouble-erf Failure: erf (-0x4p-16384): Exception "Underflow" set Failure: erf (0x1p-10000): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set Failure: erf (0x3.8b7f12369ded552p-16384): Exception "Underflow" set Failure: erf (0x4p-16384): Exception "Underflow" set Failure: erf_downward (-0x4p-16384): Exception "Underflow" set Failure: erf_downward (0x1p-10000): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set Failure: erf_downward (0x3.8b7f12369ded552p-16384): Exception "Underflow" set Failure: erf_downward (0x4p-16384): Exception "Underflow" set Failure: erf_towardzero (-0x4p-16384): Exception "Underflow" set Failure: erf_towardzero (0x1p-10000): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set Failure: erf_towardzero (0x3.8b7f12369ded552p-16384): Exception "Underflow" set Failure: erf_towardzero (0x4p-16384): Exception "Underflow" set Failure: erf_upward (-0x4p-16384): Exception "Underflow" set Failure: erf_upward (0x1p-10000): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set Failure: erf_upward (0x3.8b7f12369ded552p-16384): Exception "Underflow" set Failure: erf_upward (0x4p-16384): Exception "Underflow" set Checked on aarch64-linux-gnu with gcc and clang.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user