MHB Convert the following numbers to their floating point binary equivalent.

AI Thread Summary
The discussion focuses on converting decimal numbers to their floating point binary equivalents. For the number 18.25, the correct binary representation is confirmed as 10010.01, where 18 is represented as 10010 and 0.25 as 0.01. The second number, 1027.375, is initially misrepresented as 10000000011.010, but the correct conversion is clarified as 100000011.011. The breakdown shows that 1027 equals 10000000011 and 0.375 translates to 0.011 in binary. Additionally, the conversation touches on the IEEE 754 floating-point standard, emphasizing the need for understanding its specifications for proper representation, including the significance of rounding and the arrangement of the exponent and significand in the final binary format. Resources for further reading and online calculators for floating-point conversion are also suggested.
shamieh
Messages
538
Reaction score
0
Convert the following numbers to their floating point binary equivalent.

Can someone check my work?

a) 18.25

so I got 10010.01

I couldn't find an online conversion calculator anywhere.

can you also check my answer for this one?

b) 1027.375

I got

10000000011.010
 
Last edited:
Technology news on Phys.org
shamieh said:
Convert the following numbers to their floating point binary equivalent.

Can someone check my work?

a) 18.25

so I got 10010.01

0.25= 1/4 which is "0 times 1/2+ 1 times 1/2^2.
that is, .25= 0.01.
18= 16+ 2= 1(2^4)+ 0(2^3)+ 1(2^2)+ 1(2)+ 0(1)
so 18 is 10110.
Yes, 18.25 is 10110.01 in base 2.

]I couldn't find an online conversion calculator anywhere.

can you also check my answer for this one?

b) 1027.375

I got

10000000011.010
0.375 is 3/8= (2+ 1)/8= 1/4+ 1/8= 0(1/2)+ 1(1/4) + 1(1/8) so that is 0.011
What you have is 0.010= 0(1/2)+ 1(1/4)+ 0(1/8).

1027= 1024+ 3= 2^{10}+ 2+ 1 so that is 10000000011
so 1027.375 is 100000011.011. What you have is the binary expression of 1027.25.
 
Concerning the floating point, if you mean the IEEE 754 standard, the result depends whether you need single or double precision. I'll quote my response to a similar question from a different forum.

"Understanding IEEE 754 floating-point specification requires some time and effort. You should read your textbook or lecture notes, or at least Wikipedia pages about floating point and single-precision floating-point format.

First you need to convert 176.2058 to binary: 10110000.00110100101011110100111100001100...2. Next you round it to 24 bits: 10110000.0011010010101111. In the final representation, the decimal point should be after the first bit: 1.01100000011010010101111 * 27. The exponent is stored as the sum of 7 (or whatever it is for a given number) and 127, i.e., 134 in this case. In binary, 134 = 100001102. The first bit of significand is always 1, so it is not recorded, which leaves 23 bits. The final representation consists of the sign bit (0 means +1), the exponent and the significand. Thus, it is

0 10000110 01100000011010010101111.

Here are a couple of online calculators that can compute floating-point representation."
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top