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

Click For 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."
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
38K
  • · Replies 30 ·
2
Replies
30
Views
6K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
9
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
21K