]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Main/isnanf_ieee754.c
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / StdLib / LibC / Main / isnanf_ieee754.c
CommitLineData
2aa62f2b 1/* $NetBSD: isnanf_ieee754.c,v 1.1 2004/03/04 23:42:39 kleink Exp $ */\r
2\r
3/*\r
4 * Copyright (c) 1992, 1993\r
5 * The Regents of the University of California. All rights reserved.\r
6 *\r
7 * This software was developed by the Computer Systems Engineering group\r
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and\r
9 * contributed to Berkeley.\r
10 *\r
11 * Redistribution and use in source and binary forms, with or without\r
12 * modification, are permitted provided that the following conditions\r
13 * are met:\r
14 * 1. Redistributions of source code must retain the above copyright\r
15 * notice, this list of conditions and the following disclaimer.\r
16 * 2. Redistributions in binary form must reproduce the above copyright\r
17 * notice, this list of conditions and the following disclaimer in the\r
18 * documentation and/or other materials provided with the distribution.\r
19 * 3. Neither the name of the University nor the names of its contributors\r
20 * may be used to endorse or promote products derived from this software\r
21 * without specific prior written permission.\r
22 *\r
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
33 * SUCH DAMAGE.\r
34 *\r
35 * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp\r
36 */\r
37#include <LibConfig.h>\r
38#include <sys/EfiCdefs.h>\r
39#if defined(LIBC_SCCS) && !defined(lint)\r
40#if 0\r
41static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";\r
42#else\r
43__RCSID("$NetBSD: isnanf_ieee754.c,v 1.1 2004/03/04 23:42:39 kleink Exp $");\r
44#endif\r
45#endif /* LIBC_SCCS and not lint */\r
46\r
47#include <machine/ieee.h>\r
48#include <math.h>\r
49\r
50/*\r
51 * 7.12.3.4 isnan - test for a NaN\r
52 * IEEE 754 single-precision version\r
53 */\r
54int\r
55__isnanf(float x)\r
56{\r
57 union ieee_single_u u;\r
58\r
59 u.sngu_f = x;\r
60\r
61 return (u.sngu_sng.sng_exp == SNG_EXP_INFNAN &&\r
62 u.sngu_sng.sng_frac != 0);\r
63}\r