0

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.

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by Stemack
0

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.

Edited by Reverend Jim: Fixed formatting

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.