work around missing fpclassify

svn path=/trunk/; revision=39586
This commit is contained in:
Christoph von Wittich 2009-02-13 17:55:03 +00:00
parent 43659c9ace
commit 28c00b5c1c

View file

@ -279,7 +279,24 @@ extern "C" {
#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
/* 7.12.3.3 */
#define isinf(x) (fpclassify(x) == FP_INFINITE)
/* #define isinf(x) (fpclassify(x) == FP_INFINITE) */
/* we don't have fpclassify */
static int isinf (double d) {
int expon = 0;
double val = frexp (d, &expon);
if (expon == 1025) {
if (val == 0.5) {
return 1;
} else if (val == -0.5) {
return -1;
} else {
return 0;
}
} else {
return 0;
}
}
/* 7.12.3.4 */
/* We don't need to worry about trucation here: