2000-02-18 03:39:52 +08:00
|
|
|
/*
|
2001-04-04 21:33:01 +08:00
|
|
|
* isinff(x) returns 1 if x is +-infinity, else 0;
|
2006-02-28 07:51:28 +08:00
|
|
|
*
|
2009-07-10 01:04:56 +08:00
|
|
|
* isinf is a <math.h> macro in the C99 standard. It was previously
|
|
|
|
* implemented as isinf and isinff functions by newlib and are still declared
|
2016-04-05 04:49:31 +08:00
|
|
|
* as such in <math.h>. Newlib supplies it here as a function if the user
|
|
|
|
* chooses to use it instead of the C99 macro.
|
2000-02-18 03:39:52 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "fdlibm.h"
|
2009-07-10 01:04:56 +08:00
|
|
|
#include <ieeefp.h>
|
|
|
|
|
|
|
|
#undef isinff
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2006-02-28 07:51:28 +08:00
|
|
|
int
|
|
|
|
_DEFUN (isinff, (x),
|
|
|
|
float x)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
__int32_t ix;
|
|
|
|
GET_FLOAT_WORD(ix,x);
|
|
|
|
ix &= 0x7fffffff;
|
2001-04-04 21:33:01 +08:00
|
|
|
return FLT_UWORD_IS_INFINITE(ix);
|
2000-02-18 03:39:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _DOUBLE_IS_32BITS
|
|
|
|
|
2006-03-08 06:14:04 +08:00
|
|
|
#undef isinf
|
|
|
|
|
2006-02-28 07:51:28 +08:00
|
|
|
int
|
|
|
|
_DEFUN (isinf, (x),
|
|
|
|
double x)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
return isinff((float) x);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(_DOUBLE_IS_32BITS) */
|