LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 08-29-2005, 09:29 PM   #1
zero79
Member
 
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

or

0000 40a0

? Thanks for any thoughts.

Last edited by zero79; 08-29-2005 at 10:10 PM.
 
Old 08-29-2005, 10:30 PM   #2
tomj88
Member
 
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
 
  


Reply


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 11:59 PM
How to convert a float to its binary or hex representation in Python? zero79 Programming 1 09-01-2005 11:19 AM
count digits of a float || convert float to string nadroj Programming 6 07-11-2005 05:52 PM
Binary to Hex Ascii converter carboncopy Slackware 1 05-28-2004 10:09 AM
can't convert o to FLoat in Java alaios Programming 4 04-24-2004 03:10 PM


All times are GMT -5. The time now is 06:05 PM.

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