mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-14 17:59:28 +08:00
373f81d17c
__builtin_isinf_sign doesn't reflect the correct return value for NaN to emulate finite function. Use __builtin_isfinite instead whichg is available since GCC 4.4 just as __builtin_isinf_sign. * libm/common/sl_finite.c (finitel): Use __builtin_isfinite. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
26 lines
709 B
C
26 lines
709 B
C
/* Copyright (C) 2015 by Red Hat, Incorporated. All rights reserved.
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software
|
|
* is freely granted, provided that this notice is preserved.
|
|
*/
|
|
|
|
/* finitel(x) returns 1 is x is finite, else 0; */
|
|
|
|
#include <math.h>
|
|
|
|
int
|
|
finitel (long double x)
|
|
{
|
|
#ifdef _LDBL_EQ_DBL
|
|
return finite (x);
|
|
#else
|
|
/* Let the compiler do this for us.
|
|
Note - we do not know how many bits there are in a long double.
|
|
Some architectures for example have an 80-bit long double whereas
|
|
others use 128-bits. We use macros and comiler builtin functions
|
|
to avoid specific knowledge of the long double format. */
|
|
return __builtin_isfinite (x);
|
|
#endif
|
|
}
|
|
|