sign of infinity and isinf()?
Steve Kargl
sgk at troutmask.apl.washington.edu
Sun Jun 13 16:07:19 GMT 2004
Gang,
I don't have a copy of the C99 standard only Harbison and Steele,
5th Ed. On page 440, they state: "The isinf macro returns a nonzero
value if and only if its argument is infinite (with any sign)."
The program below does note return the sign.
kargl[243] gcc -o a -O a.c
kargl[244] ./a
-inf
1
#include <stdio.h>
#include <math.h>
int main(void) {
double x, y;
x = -1.;
y = 0.;
x /= y;
printf("%lf\n", x);
printf("%d\n", isinf(x));
}
--
Steve
More information about the freebsd-standards
mailing list