LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to convert a float to its binary or hex representation in Python? (https://www.linuxquestions.org/questions/linux-software-2/how-to-convert-a-float-to-its-binary-or-hex-representation-in-python-358307/)

zero79 08-29-2005 08:29 PM

How to convert a float to its binary or hex representation in Python?
 
Say I want to convert the float 5.0 to its binary equivilient, how do I do this? I mean, how do I get Python to tell me that 5.0 (single precision) is described in machine code as something like

0000 0000 0000 0000 0100 0000 1010 0000

or

0000 40a0

? Thanks for any thoughts.

tomj88 08-29-2005 09:30 PM

I don't know the answer, but wouldn't it be better if you posted this in the programming forum? Hint for the future ;) Sorry I couldn't help


All times are GMT -5. The time now is 10:30 PM.