mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-08 10:20:15 +00:00
math: Properly cast X_TLOSS to float [BZ #28713]
Add
#define AS_FLOAT_CONSTANT_1(x) x##f
#define AS_FLOAT_CONSTANT(x) AS_FLOAT_CONSTANT_1(x)
to cast X_TLOSS to float at compile-time 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.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
(cherry picked from commit 6e30181b4a
)
This commit is contained in:
parent
dd0c72fb46
commit
80b24b8654
@ -49,6 +49,8 @@ extern int matherr (struct exception *__exc);
|
|||||||
extern int __matherr (struct exception *__exc);
|
extern int __matherr (struct exception *__exc);
|
||||||
|
|
||||||
#define X_TLOSS 1.41484755040568800000e+16
|
#define X_TLOSS 1.41484755040568800000e+16
|
||||||
|
#define AS_FLOAT_CONSTANT_1(x) x##f
|
||||||
|
#define AS_FLOAT_CONSTANT(x) AS_FLOAT_CONSTANT_1(x)
|
||||||
|
|
||||||
/* Types of exceptions in the `type' field. */
|
/* Types of exceptions in the `type' field. */
|
||||||
#define DOMAIN 1
|
#define DOMAIN 1
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
float
|
float
|
||||||
__j0f (float x)
|
__j0f (float x)
|
||||||
{
|
{
|
||||||
if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
|
if (__builtin_expect (isgreater (fabsf (x),
|
||||||
|
AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
||||||
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
||||||
/* j0(|x|>X_TLOSS) */
|
/* j0(|x|>X_TLOSS) */
|
||||||
return __kernel_standard_f (x, x, 134);
|
return __kernel_standard_f (x, x, 134);
|
||||||
@ -43,7 +44,7 @@ float
|
|||||||
__y0f (float x)
|
__y0f (float x)
|
||||||
{
|
{
|
||||||
if (__builtin_expect (islessequal (x, 0.0f)
|
if (__builtin_expect (islessequal (x, 0.0f)
|
||||||
|| isgreater (x, (float) X_TLOSS), 0)
|
|| isgreater (x, AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
||||||
&& _LIB_VERSION != _IEEE_)
|
&& _LIB_VERSION != _IEEE_)
|
||||||
{
|
{
|
||||||
if (x < 0.0f)
|
if (x < 0.0f)
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
float
|
float
|
||||||
__j1f (float x)
|
__j1f (float x)
|
||||||
{
|
{
|
||||||
if (__builtin_expect (isgreater (fabsf (x), X_TLOSS), 0)
|
if (__builtin_expect (isgreater (fabsf (x),
|
||||||
|
AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
||||||
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
||||||
/* j1(|x|>X_TLOSS) */
|
/* j1(|x|>X_TLOSS) */
|
||||||
return __kernel_standard_f (x, x, 136);
|
return __kernel_standard_f (x, x, 136);
|
||||||
@ -43,7 +44,7 @@ float
|
|||||||
__y1f (float x)
|
__y1f (float x)
|
||||||
{
|
{
|
||||||
if (__builtin_expect (islessequal (x, 0.0f)
|
if (__builtin_expect (islessequal (x, 0.0f)
|
||||||
|| isgreater (x, (float) X_TLOSS), 0)
|
|| isgreater (x, AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
||||||
&& _LIB_VERSION != _IEEE_)
|
&& _LIB_VERSION != _IEEE_)
|
||||||
{
|
{
|
||||||
if (x < 0.0f)
|
if (x < 0.0f)
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
float
|
float
|
||||||
__jnf (int n, float x)
|
__jnf (int n, float x)
|
||||||
{
|
{
|
||||||
if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
|
if (__builtin_expect (isgreater (fabsf (x),
|
||||||
|
AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
||||||
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
&& _LIB_VERSION != _IEEE_ && _LIB_VERSION != _POSIX_)
|
||||||
/* jn(n,|x|>X_TLOSS) */
|
/* jn(n,|x|>X_TLOSS) */
|
||||||
return __kernel_standard_f (n, x, 138);
|
return __kernel_standard_f (n, x, 138);
|
||||||
@ -43,7 +44,7 @@ float
|
|||||||
__ynf (int n, float x)
|
__ynf (int n, float x)
|
||||||
{
|
{
|
||||||
if (__builtin_expect (islessequal (x, 0.0f)
|
if (__builtin_expect (islessequal (x, 0.0f)
|
||||||
|| isgreater (x, (float) X_TLOSS), 0)
|
|| isgreater (x, AS_FLOAT_CONSTANT (X_TLOSS)), 0)
|
||||||
&& _LIB_VERSION != _IEEE_)
|
&& _LIB_VERSION != _IEEE_)
|
||||||
{
|
{
|
||||||
if (x < 0.0f)
|
if (x < 0.0f)
|
||||||
|
Loading…
Reference in New Issue
Block a user