From b42eb01e5859a8554b91b8a7a3c42cbdf3917f9c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 29 Apr 2007 16:57:17 +0400 Subject: [PATCH] If isinf() is not available on a target platform, use our own imlementation via finite() and isnan(). If either of the last two is not available as well, use simple replacements which are platform-neutral, but slower than compiler intrinsics. --- include/my_global.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index f446c283d50..e9b371d8d30 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -784,13 +784,20 @@ typedef SOCKET_SIZE_TYPE size_socket; #define SSIZE_MAX ((~((size_t) 0)) / 2) #endif +#ifndef HAVE_FINITE +#define finite(x) (1.0 / fabs(x) > 0.0) +#endif + +#ifndef HAVE_ISNAN +#define isnan(x) ((x) != (x)) +#endif + #if !defined(HAVE_ISINF) /* The configure check for "isinf with math.h" has failed */ #ifdef isinf #undef isinf #endif -/* Define isinf to never say that X is infinite */ -#define isinf(X) 0 +#define isinf(X) (!finite(X) && !isnan(X)) #endif /* Define missing math constants. */