LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-22-2007, 05:52 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
binaries and doubles


Hi there
Does anybody know how double values are represented in a binary form.
For instance, how 10.2 can be expressed, and in reality how is this done(inside computer). Is anyway that we can use a function to return that number in a binary representation. As far as i know Java has some methods to deal with binaries. If am right we can return a binary from an integer.
Any ideas?

Thanks for your time
 
Old 10-22-2007, 06:45 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You can see it with bc:

Type "bc -l" to start bc with standard math library.

In the bc window type "obase=2" to set output base to 2 (binary). Input base defaults to 10 (decimal).

Then type 10.2 (decimal) - you'll see it convert the output to:
1010.0011
which is the binary equivalent.
 
Old 10-22-2007, 07:08 PM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
I will just post some links for you to read:
<a href="http://www.validlab.com/goldberg/paper.pdf">What every computer scientist should know about floating point arithmetic </a>
<a href="http://grouper.ieee.org/groups/754/">IEEE 754 group</a>
<a href="http://babbage.cs.qc.edu/IEEE-754/Decimal.html">floating point calculator</a>
<a href="http://en.wikipedia.org/wiki/IEEE_floating-point_standard">wiki article</a>
 
  


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
C++ floats and doubles ArlexBee-871RBO Programming 0 03-01-2007 09:04 PM
Question About Floats and Doubles gomez6211 Programming 3 09-13-2006 07:47 PM
LXer: Linux phone standards group doubles membership LXer Syndicated Linux News 0 07-17-2006 07:54 AM
ATI Mobility Radeon 9000 doubles game speed ichi Linux - Software 1 07-31-2005 06:27 AM
STL vector of 3 doubles? true_atlantis Programming 2 04-22-2004 10:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:55 AM.

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
Open Source Consulting | Domain Registration