source: trunk/libs/newlib/src/newlib/libm/common/sf_fpclassify.c @ 620

Last change on this file since 620 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 713 bytes
Line 
1/* Copyright (C) 2002,2007 by  Red Hat, Incorporated. All rights reserved.
2 *
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
5 */
6
7#include "fdlibm.h"
8
9int
10__fpclassifyf (float x)
11{
12  __uint32_t w;
13
14  GET_FLOAT_WORD(w,x);
15 
16  if (w == 0x00000000 || w == 0x80000000)
17    return FP_ZERO;
18  else if ((w >= 0x00800000 && w <= 0x7f7fffff) ||
19           (w >= 0x80800000 && w <= 0xff7fffff))
20    return FP_NORMAL;
21  else if ((w >= 0x00000001 && w <= 0x007fffff) ||
22           (w >= 0x80000001 && w <= 0x807fffff))
23    return FP_SUBNORMAL;
24  else if (w == 0x7f800000 || w == 0xff800000)
25    return FP_INFINITE;
26  else
27    return FP_NAN;
28}
29
Note: See TracBrowser for help on using the repository browser.