In Python, unpack
can convert Hex string to IEEE754 Float number:
import struct
print(struct.unpack('<f', bytes.fromhex("00000042"))[0]) # 32.0
<
represents LITTLE ENDIAN byte order, and f
represents Float format.
How to convert Hex string to IEEE754 Float number with Raku?
00 00 00 42
? And what is the number 32.0? If you enter "00000052" in your Python code above you get137438953472.0
, is that intended? – Commonlysay "00000042".encode>>.base(16)[*-1].Rat.raku
. – Commonly00000042
is a list of bytes:00 00 00 42
– Intelligible