xref: /csrg-svn/lib/libc/i386/gen/isinf.c (revision 47560)
1*47560Sbostic /*-
2*47560Sbostic  * Copyright (c) 1991 The Regents of the University of California.
3*47560Sbostic  * All rights reserved.
4*47560Sbostic  *
5*47560Sbostic  * %sccs.include.redist.c%
6*47560Sbostic  */
7*47560Sbostic 
8*47560Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*47560Sbostic static char sccsid[] = "@(#)isinf.c	5.1 (Berkeley) 03/18/91";
10*47560Sbostic #endif /* LIBC_SCCS and not lint */
11*47560Sbostic 
12*47560Sbostic #include <sys/types.h>
13*47560Sbostic 
14*47560Sbostic isnan(d)
15*47560Sbostic 	double d;
16*47560Sbostic {
17*47560Sbostic 	register struct IEEEdp {
18*47560Sbostic 		u_int manl : 32;
19*47560Sbostic 		u_int manh : 20;
20*47560Sbostic 		u_int  exp : 11;
21*47560Sbostic 		u_int sign :  1;
22*47560Sbostic 	} *p = (struct IEEEdp *)&d;
23*47560Sbostic 
24*47560Sbostic 	return(p->exp == 2047 && (p->manh || p->manl));
25*47560Sbostic }
26*47560Sbostic 
27*47560Sbostic isinf(d)
28*47560Sbostic 	double d;
29*47560Sbostic {
30*47560Sbostic 	register struct IEEEdp {
31*47560Sbostic 		u_int manl : 32;
32*47560Sbostic 		u_int manh : 20;
33*47560Sbostic 		u_int  exp : 11;
34*47560Sbostic 		u_int sign :  1;
35*47560Sbostic 	} *p = (struct IEEEdp *)&d;
36*47560Sbostic 
37*47560Sbostic 	return(p->exp == 2047 && !p->manh && !p->manl);
38*47560Sbostic }
39