]>
git.saurik.com Git - apple/libc.git/blob - gen.subproj/isnan.c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* @(#)s_isnan.c 5.1 93/09/24 */
24 * ====================================================
25 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
27 * Developed at SunPro, a Sun Microsystems, Inc. business.
28 * Permission to use, copy, modify, and distribute this
29 * software is freely granted, provided that this notice
31 * ====================================================
34 #if defined(LIBM_SCCS) && !defined(lint)
35 static char rcsid
[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
39 * isnan(x) returns 1 is x is nan, else 0;
43 #include <sys/types.h>
50 #if defined(__BIG_ENDIAN__)
58 } ieee_double_shape_type
;
59 /* Get two 32 bit ints from a double. */
61 #define EXTRACT_WORDS(ix0,ix1,d) \
63 ieee_double_shape_type ew_u; \
65 (ix0) = ew_u.parts.msw; \
66 (ix1) = ew_u.parts.lsw; \
78 EXTRACT_WORDS(hx
,lx
,x
);
80 hx
|= (u_int32_t
)(lx
|(-lx
))>>31;
82 return (int)((u_int32_t
)(hx
))>>31;