Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2004 09:06:30 -0700
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        freebsd-standards@freebsd.org
Subject:   sign of infinity and isinf()?
Message-ID:  <20040613160630.GB12116@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040613160630.GB12116>