Trying to decode a bytes array in Python 3.8 where the sending interface spec states the format is "float (serialized as double)".
Using a sample bytes array received from the interface, this is the result i get
>>> import struct
>>> bytes_arr = b'\xbf\xe9\x99\x99\xa0\x00\x00\x00'
>>> print(struct.unpack('d', bytes_arr))
(3.40792534166e-312,)
The parent application (displaying the same data i am receiving over the interface) states the answer to be -0.8. This is obviously rounded but a different decode.
Where am i going wrong?
>Solution :
Your value is in big-endian format:
>>> print(struct.unpack('>d', bytes_arr))
(-0.800000011920929,)