1 /* public domain rewrite of isinf(3) */
11 if (IsNANorINF(n
) && IsINF(n
)) {
21 #include "ruby/config.h"
23 #if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
31 * isinf may be provided only as a macro.
32 * ex. HP-UX, Solaris 10
33 * http://www.gnu.org/software/automake/manual/autoconf/Function-Portability.html
39 return (!finite(n
) && !isnan(n
));
51 static double zero(void) { return 0.0; }
52 static double one (void) { return 1.0; }
53 static double inf (void) { return one() / zero(); }
58 static double pinf
= 0.0;
59 static double ninf
= 0.0;
65 return memcmp(&n
, &pinf
, sizeof n
) == 0
66 || memcmp(&n
, &ninf
, sizeof n
) == 0;