I am trying to convert the following JavaScript code to Python:
var n = 0.3846705659431655
n.toString(16)
result: "0.6279c52c75af6"
The challenge I am having right now is that I can't seem to convert floats in Python. It will error on me or give me a different result.
Example:
n = 0.3846705659431655
float.hex(n)
result: 0x1.89e714b1d6bd8p-2
expected result: "0.6279c52c75af6"
Is there any other method for me to get the same result in Python?