I want to reinterpret 4 bytes as IEEE 754 single-precision binary in C.
To obtain the bytes that represent float
, I used:
num = *(uint32_t*)&MyFloatNumber;
aux[0] = num & 0xFF;
aux[1] = (num >> 8) & 0xFF;
aux[2] = (num >> 16) & 0xFF;
aux[3] = (num >> 24) & 0xFF;
- num is a uint32_t.
- aux[] is int[4].
To reinterpret the bytes as a float
, I’m trying:
Buff = *(float*)&aux;
In that second case nothing apears on "Buff"
- Buff is a
float
.
What am I doing wrong in the second case?