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