You got the first four bytes of a 64-bit double
representation, not the four bytes of a 32-byte representation.
According to the IEEE 754 calculator, 64-bit representation of 3768.36
is
0x40, 0xAD, 0x70, 0xB8, 0x51, 0xEB, 0x85, 0x1F
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
This is what you have This part is missing
You took the first four bytes of it, and tried re-interpreting it as a float
. That's why it did not work.
A 32-bit representation of 3768.36
is
0x45, 0x6B, 0x85, 0xC3
Converting it to float
by stuffing the bytes into an array and re-interpreting produces the desired result (demo).