Convert hex string representation for float in python

I have form data (IEEE 745 hexadecimal)

0x1.5c28f5c28f5c3p-1

How do I convert this to float in python? Is this a standard module?

Hello,

Alex

+5
source share
2 answers
>>> float.fromhex('0x1.5c28f5c28f5c3p-1') 0.68 
+10
source

Ah ha:

In the standard library "float.fromhex",

https://docs.python.org/2/library/stdtypes.html#float.fromhex

+5
source

Source: https://habr.com/ru/post/1237112/


All Articles