2001-03-06 11:17:54 +03:00
|
|
|
/* public domain rewrite of isnan(3) */
|
|
|
|
|
2010-07-28 12:12:01 +04:00
|
|
|
#include "ruby/missing.h"
|
|
|
|
|
2013-04-23 15: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-22 05:28:00 +04:00
|
|
|
static int double_ne(double n1, double n2);
|
1999-08-13 09:45:20 +04:00
|
|
|
|
|
|
|
int
|
2005-10-22 05:28:00 +04:00
|
|
|
isnan(double n)
|
1999-08-13 09:45:20 +04:00
|
|
|
{
|
2003-12-20 18:45:15 +03:00
|
|
|
return double_ne(n, n);
|
1999-08-13 09:45:20 +04:00
|
|
|
}
|
|
|
|
|
2003-12-20 18:45:15 +03:00
|
|
|
static int
|
2005-10-22 05:28:00 +04:00
|
|
|
double_ne(double n1, double n2)
|
1999-08-13 09:45:20 +04:00
|
|
|
{
|
2003-12-20 18:45:15 +03:00
|
|
|
return n1 != n2;
|
1999-08-13 09:45:20 +04:00
|
|
|
}
|
2013-04-23 15:27:07 +04:00
|
|
|
#endif
|