I am trying to convert a floating point number from decimal to hexadecimal.
But I am not getting in the format I want.
For example, if the decimal number is 54.75
, I want the hexadecimal in the format 36.C0
However, I am not able to convert it to this format.
float.hex(54.75)
gives 0x1.b600000000000p+5
Python built-in function hex()
also doesn't support float numbers.
As stated in the comments, you can split the number into various parts and then combine the converted results. For example:
Prints: