xref: /reactos/sdk/lib/crt/float/isnan.c (revision d2aeaba5)
1 /* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, write to the Free
16    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17    Boston, MA 02110-1301, USA.
18 */
19 
20 #include <precomp.h>
21 
22 #if defined(_MSC_VER) && defined(_M_ARM)
23 #pragma function(_isnan)
24 #endif /* _MSC_VER */
25 
26 /*
27  * @implemented
28  */
29 int CDECL _isnan(double __x)
30 {
31 	union
32 	{
33 		double*   __x;
34 		double_s*   x;
35 	} x;
36     	x.__x = &__x;
37 	return ( x.x->exponent == 0x7ff  && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));
38 }
39 
40 /*
41  * @implemented
42  */
43 int CDECL _finite(double __x)
44 {
45 	union
46 	{
47 		double*   __x;
48 		double_s*   x;
49 	} x;
50 
51 	x.__x = &__x;
52 
53     return ((x.x->exponent & 0x7ff) != 0x7ff);
54 }
55