this repo has no description
1
2/*
3 * fpclassifyf.c
4 *
5 * by Ian Ollmann
6 *
7 * Copyright (c) 2007, Apple Inc. All Rights Reserved.
8 *
9 * C99 implementation for __fpclassifyf function (called by FPCLASSIFY macro.)
10 */
11
12#include <math.h>
13#include <stdint.h>
14
15int __fpclassifyf( float x )
16{
17 union{ float f; uint32_t u;}u = {x};
18
19 uint32_t exp = (u.u & 0x7fffffff) >> 23;
20
21 if( 0 == exp )
22 {
23 if( u.u & 0x007fffffU )
24 return FP_SUBNORMAL;
25
26 return FP_ZERO;
27 }
28
29 if( 0xff == exp )
30 {
31 if( u.u & 0x007fffffU )
32 return FP_NAN;
33
34 return FP_INFINITE;
35 }
36
37 return FP_NORMAL;
38}