Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / common / s_fpclassify.c
blob3ebba70309d68b1952ede31321b0e32863b483f5
1 /* Copyright (C) 2002, 2007 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
5 */
7 #include "fdlibm.h"
9 int
10 __fpclassifyd (double x)
12 __uint32_t msw, lsw;
14 EXTRACT_WORDS(msw,lsw,x);
16 if ((msw == 0x00000000 && lsw == 0x00000000) ||
17 (msw == 0x80000000 && lsw == 0x00000000))
18 return FP_ZERO;
19 else if ((msw >= 0x00100000 && msw <= 0x7fefffff) ||
20 (msw >= 0x80100000 && msw <= 0xffefffff))
21 return FP_NORMAL;
22 else if ((msw >= 0x00000000 && msw <= 0x000fffff) ||
23 (msw >= 0x80000000 && msw <= 0x800fffff))
24 /* zero is already handled above */
25 return FP_SUBNORMAL;
26 else if ((msw == 0x7ff00000 && lsw == 0x00000000) ||
27 (msw == 0xfff00000 && lsw == 0x00000000))
28 return FP_INFINITE;
29 else
30 return FP_NAN;