I receive 4 seperate bytes from the comm port.
I need to create an IEEE754 single float out of them.
Presently I have 2 ways of doing this, non are very elegant.
1) Split all 4 bytes into a binary string (0s and 1s),
add them together, split them up using the IEEEE 754
rules, convert them back into a number by stepping
through and anding with powers of 2.
2) Open a file as binary, save the 4 bytes, close the file
open the file again and read the number back as a
single.
Can anyone suggest a better method, i.e. some way I could
save the 4 bytes to a specific memory location and then
read them back as a float.
I need to create an IEEE754 single float out of them.
Presently I have 2 ways of doing this, non are very elegant.
1) Split all 4 bytes into a binary string (0s and 1s),
add them together, split them up using the IEEEE 754
rules, convert them back into a number by stepping
through and anding with powers of 2.
2) Open a file as binary, save the 4 bytes, close the file
open the file again and read the number back as a
single.
Can anyone suggest a better method, i.e. some way I could
save the 4 bytes to a specific memory location and then
read them back as a float.