xref: /original-bsd/lib/libc/i386/gen/isinf.c (revision a1c2194a)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)isinf.c	5.1 (Berkeley) 03/18/91";
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