diff options
author | unknown <kaa@polly.local> | 2007-04-29 16:57:17 +0400 |
---|---|---|
committer | unknown <kaa@polly.local> | 2007-04-29 16:57:17 +0400 |
commit | b42eb01e5859a8554b91b8a7a3c42cbdf3917f9c (patch) | |
tree | 0edaa0050ac0cf6a2704778dc17bccd6d7093135 /include | |
parent | 024dbd231a76f6455c2dc62a06dda70879a85704 (diff) | |
download | mariadb-git-b42eb01e5859a8554b91b8a7a3c42cbdf3917f9c.tar.gz |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_global.h | 11 |
1 files 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. */ |