C Programming - Floating Point Issues - Discussion

Discussion Forum : Floating Point Issues - General Questions (Q.No. 7)
7.
The binary equivalent of 5.375 is
101.101110111
101.011
101011
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
76 comments Page 3 of 8.

Sasi said:   1 decade ago
The binary code for 5 is 101.

For decimal values(.375) the binary values can be found on the basis of following:

Decimal*base of binary.
0.375*2 = 0.750 pick the number before point hence 0.
0.750*2 = 1.500 hence 1.
0.500*2 = 1.000 hence 1.

Write from the top to bottom like 011 and not as 110.
(5.375)-->101.011.

DIGANT said:   1 decade ago
For the Floating point number to binary of 5.375.

Step 1 : Divide the number into 2 parts:

1. BEFORE FLOATING POINT.
2. AFTER FLOATING POINT.

Step 2 : Find out the binary of Number BEFORE FLOATING POINT.

5 ---> 101

Step 3 : Find out the binary of Number AFTER FLOATING POINT.

0.375 * 2 -> 0.750 ---> 0
0.750 * 2 -> 1.50 ---> 1
(now remove the non-zero number before floating point)
0.50 * 2 -> 1.00 ---> 1

Step 4 : Now read number from bottom to top.

(110).

Step 5 : Put the number together with floating point.

(101 . 110) -------> ANSWER.

Poonamchandra said:   1 decade ago
That depends on upto how many digits you want after decimal.

3.02

3------->011

If you want 4 digits after decimal, then solution will be:

0.02*2=0.04------->0
0.04*2=0.08------->0
0.08*2=0.16------->0
0.16*2=0.32------->0

3.02 = 11.0000

and 8 digits after decimal then solution will be:-

0.02*2=0.04------->0
0.04*2=0.08------->0
0.08*2=0.16------->0
0.16*2=0.32------->0
0.32*2=0.64------->0
0.64*2=1.28------->1
0.28*2=0.56------->0
0.56*2=1.12------->1

3.02 = 11.00000101

Poonamchandra said:   1 decade ago
5.375.

5 --> 101.

0.375 * 2 = 0.75 = 0 + .75----->0.
0.75 * 2 = 1.5 = 1 + .5 ----->1.
0.5 * 2 = 1.0 = 1 + .0 ----->1.

5.375----->101.011.

Gautam said:   1 decade ago
How do we convert 3.02 in binary?

Vijaygodaraa said:   1 decade ago
5.375.

First convert 5 into binary as,

(5/2)=quotient(2) and remainder (1).
(2/2)=quotient(1) and remainder (0).
(1/1)=quotient(1) and remainder (1).

Therefore 5 = 101 (write remainder from bottom to top).

Now convert 0.375 into binary as,

0.375 * 2 = 0.75,
0.75 * 2 = 1.5,
0.5 * 2 = 1.0,

Do it until we don't get an integer.
(write remainder from top to bottom).

Therefore the answer is 5.375=101.011.

Deepika said:   1 decade ago
8421
0101 - 5(4+1)
0011 - 3(2+1)

So 5.3 = 101.011

Yograj said:   1 decade ago
8421 8421 8421
0000 0000 0000
Simple logic to remember this:
Given 101.011
1st digit missing consider 421 i.e 101 (1-has value .0-nothing)
101.011
401.021
i.e
5.3(nearest answer).

Shruthi kamath said:   1 decade ago
Thanks surya for clear explanation.

Jhunu said:   1 decade ago
Thanks narayan.


Post your comments here:

Your comments will be displayed after verification.