943,640 Members | Top Members by Rank

Ad:
Jun 30th, 2009
0

Binary

Expand Post »
Sorry in advance if this is in the wrong forums but I am new here and was not too sure where to post for help. Onto business I was wondering if anybody knows how to convert a number that has a decimal point in it (example: 0.31) into binary? I have been tasked to do it but everywhere I look is no help and was wondering if anybody here could shed some light onto this?

Thanks in advance,
Steve.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Stemack is offline Offline
2 posts
since Jun 2009
Jul 1st, 2009
0

Re: Binary

You are talking about floating point.
Dependent upon the data format typically IEEE
32-bit SPFP Single-Precision Floating-Point
64-bit DPFP Double-Precision Floating-Point
80-bit Double-Extended Precision Floating-Point

there are three components.
A sign bit, typically the MSB.
The Exponent
and
the Mantissa.
So 1.0 in 32-bit using IEEE would be
0x3f800000
-1.0
0xbf800000

32-bit SPFP
Sign:{31} Exponent:{30...23} mantissa:{22...0}
64-bit DPFP
63 62...52 51....0
80-bit
79 78...64 62....0
There's an implied (1) bit at bit 63.
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Jul 2nd, 2009
0

Re: Binary

e.g.: 0.25
0.25 * 2 = 0.5 --> 0*2^(-1)
0.5 * 2 = 1.0 --> 1*2^(-2)
--> (0.25)decimal = (0.01)binary
Last edited by Deque; Jul 2nd, 2009 at 3:59 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Deque is offline Offline
5 posts
since Jul 2009
Jul 2nd, 2009
0

Re: Binary

0.25 = 0x3e800000
0.01 = 0x3c23d79a = 0.0099999998

Or fixed point BCD (2 places)
0.25
0x0000000025
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Jul 2nd, 2009
0

Re: Binary

Hey thanks mate this has helped a great deal! +rep
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Stemack is offline Offline
2 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: Final Year Project
Next Thread in Computer Science Forum Timeline: UML ?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC