[PATCH 2/2] math: Add X_TLOSSf [BZ #28713]
Paul Zimmermann
Paul.Zimmermann@inria.fr
Tue Dec 21 09:14:39 GMT 2021
Dear HJ,
> Date: Mon, 20 Dec 2021 15:18:17 -0800
> From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
> Cc: Joseph Myers <joseph@codesourcery.com>
>
> Change X_TLOSS to the hexadecimal notation and add X_TLOSSf to define
> the float verion of X_TLOSS to fix
>
> FAIL: math/test-float-j0
> FAIL: math/test-float-jn
> FAIL: math/test-float-y0
> FAIL: math/test-float-y1
> FAIL: math/test-float-yn
> FAIL: math/test-float32-j0
> FAIL: math/test-float32-jn
> FAIL: math/test-float32-y0
> FAIL: math/test-float32-y1
> FAIL: math/test-float32-yn
>
> when compiling with GCC 12.
I confirm these tests fail with gcc 12, and pass with the patch below
(tested on x86_64 linux).
> math/math-svid-compat.h | 3 ++-
> math/w_j0f_compat.c | 4 ++--
> math/w_j1f_compat.c | 2 +-
> math/w_jnf_compat.c | 4 ++--
> 4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/math/math-svid-compat.h b/math/math-svid-compat.h
> index 5c18cb1b03..61d22ce461 100644
> --- a/math/math-svid-compat.h
> +++ b/math/math-svid-compat.h
> @@ -48,7 +48,8 @@ struct exception
> extern int matherr (struct exception *__exc);
> extern int __matherr (struct exception *__exc);
>
> -#define X_TLOSS 1.41484755040568800000e+16
> +#define X_TLOSS 0x1.921fb54442d180000000p+53
why did you change the alignement?
> +#define X_TLOSSf 0x1.921fb6p+53
I would add a suffix 'f'
> /* Types of exceptions in the `type' field. */
> #define DOMAIN 1
> diff --git a/math/w_j0f_compat.c b/math/w_j0f_compat.c
> index d375f3bfb0..7e8be846cb 100644
> --- a/math/w_j0f_compat.c
> +++ b/math/w_j0f_compat.c
> @@ -27,7 +27,7 @@
> float
> __j0f (float x)
> {
> - if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
> + if (__builtin_expect (isgreater (fabsf (x), X_TLOSSf), 0)
> && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
> /* j0(|x|>X_TLOSS) */
> return __kernel_standard_f (x, x, 134);
> @@ -42,7 +42,7 @@ float
> __y0f (float x)
> {
> if (__builtin_expect (islessequal (x, 0.0f)
> - || isgreater (x, (float) X_TLOSS), 0)
> + || isgreater (x, X_TLOSSf), 0)
> && _LIB_VERSION != _IEEE_)
> {
> if (x < 0.0f)
> diff --git a/math/w_j1f_compat.c b/math/w_j1f_compat.c
> index 81e56b771e..471dd93fdd 100644
> --- a/math/w_j1f_compat.c
> +++ b/math/w_j1f_compat.c
> @@ -42,7 +42,7 @@ float
> __y1f (float x)
> {
> if (__builtin_expect (islessequal (x, 0.0f)
> - || isgreater (x, (float) X_TLOSS), 0)
> + || isgreater (x, X_TLOSSf), 0)
> && _LIB_VERSION != _IEEE_)
> {
> if (x < 0.0f)
> diff --git a/math/w_jnf_compat.c b/math/w_jnf_compat.c
> index 296e631566..80af01385a 100644
> --- a/math/w_jnf_compat.c
> +++ b/math/w_jnf_compat.c
> @@ -27,7 +27,7 @@
> float
> __jnf (int n, float x)
> {
> - if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
> + if (__builtin_expect (isgreater (fabsf (x), X_TLOSSf), 0)
> && _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
> /* jn(n,|x|>X_TLOSS) */
> return __kernel_standard_f (n, x, 138);
> @@ -42,7 +42,7 @@ float
> __ynf (int n, float x)
> {
> if (__builtin_expect (islessequal (x, 0.0f)
> - || isgreater (x, (float) X_TLOSS), 0)
> + || isgreater (x, X_TLOSSf), 0)
> && _LIB_VERSION != _IEEE_)
> {
> if (x < 0.0f)
> --
> 2.33.1
looks good to me, thanks!
Paul
PS: after this patch, and the previous one, there is only one remaining
failure with gcc12:
FAIL: elf/tst-env-setuid
More information about the Libc-alpha
mailing list