Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-29-2005, 08:29 PM   #1
Registered: Nov 2003
Location: Ohio
Distribution: Debian Unstable
Posts: 460

Rep: Reputation: 30
Question 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


0000 40a0

? Thanks for any thoughts.

Last edited by zero79; 08-29-2005 at 09:10 PM.
Old 08-29-2005, 09:30 PM   #2
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Rep: Reputation: 30
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
representation of binary tree using array sajith Programming 3 10-06-2005 10:59 PM
How to convert a float to its binary or hex representation in Python? zero79 Programming 1 09-01-2005 10:19 AM
count digits of a float || convert float to string nadroj Programming 6 07-11-2005 04:52 PM
Binary to Hex Ascii converter carboncopy Slackware 1 05-28-2004 09:09 AM
can't convert o to FLoat in Java alaios Programming 4 04-24-2004 02:10 PM

All times are GMT -5. The time now is 05:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration