2001-03-06 03:17:54 -05:00
|
|
|
/* public domain rewrite of isnan(3) */
|
|
|
|
|
2010-07-28 04:12:01 -04:00
|
|
|
#include "ruby/missing.h"
|
|
|
|
|
2013-04-23 07:27:07 -04:00
|
|
|
/*
|
|
|
|
* isnan() may be a macro, a function or both.
|
|
|
|
* (The C99 standard defines that isnan() is a macro, though.)
|
|
|
|
* http://www.gnu.org/software/automake/manual/autoconf/Function-Portability.html
|
|
|
|
*
|
|
|
|
* macro only: uClibc
|
|
|
|
* both: GNU libc
|
|
|
|
*
|
|
|
|
* This file is compile if no isnan() function is available.
|
|
|
|
* (autoconf AC_REPLACE_FUNCS detects only the function.)
|
|
|
|
* The macro is detected by following #ifndef.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef isnan
|
2005-10-21 21:28:00 -04:00
|
|
|
static int double_ne(double n1, double n2);
|
1999-08-13 01:45:20 -04:00
|
|
|
|
|
|
|
int
|
2005-10-21 21:28:00 -04:00
|
|
|
isnan(double n)
|
1999-08-13 01:45:20 -04:00
|
|
|
{
|
2003-12-20 10:45:15 -05:00
|
|
|
return double_ne(n, n);
|
1999-08-13 01:45:20 -04:00
|
|
|
}
|
|
|
|
|
2003-12-20 10:45:15 -05:00
|
|
|
static int
|
2005-10-21 21:28:00 -04:00
|
|
|
double_ne(double n1, double n2)
|
1999-08-13 01:45:20 -04:00
|
|
|
{
|
2003-12-20 10:45:15 -05:00
|
|
|
return n1 != n2;
|
1999-08-13 01:45:20 -04:00
|
|
|
}
|
2013-04-23 07:27:07 -04:00
|
|
|
#endif
|