43 uint32_t hexpmant = ((uint32_t) (h) << 17) >> 4;
44 v.
i = ((uint32_t) (h >> 15)) << 31;
47 if ((hexpmant >= 0x00800000)) {
51 if ((hexpmant < 0x0f800000)) {
58 else if (hexpmant != 0) {
66 while (0 == ((hexpmant << lc) & 0x80000000)) {
82 v.
i |= (hexpmant << lc);
106 uint32_t e, m, ui, r, shift;
110 ui = (v.
i & ~0x80000000);
111 ret = ((v.
i >> 16) & 0x8000);
114 if (ui >= 0x38800000) {
116 if (ui >= 0x7f800000) {
118 if (ui == 0x7f800000) {
121 m = (ui & 0x7fffff) >> 13;
123 return ret | (uint16_t) m | (uint16_t) (m == 0);
127 if (ui > 0x477fefff) {
132 ui = ((ui + 0x00000fff + ((ui >> 13) & 1)) >> 13);
133 return ret | (uint16_t) ui;
137 if (ui < 0x33000001) {
144 m = 0x800000 | (ui & 0x7fffff);
145 r = m << (32 - shift);
147 if (r > 0x80000000 || (r == 0x80000000 && (ret & 0x1) != 0)) {
uint16_t float16_t
Definition: float16.h:21
static float16_t NN_float_to_half(float f)
Definition: float16.h:96
static float NN_half_to_float(float16_t h)
Definition: float16.h:30
float f
Definition: float16.h:18
uint32_t i
Definition: float16.h:17