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 6 of 8.

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.

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

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.

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

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.

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.

Zeeshan said:   1 decade ago
If equivalent is to use in binary formation.
by language is,

5<--1011011
1010101
101.1011
1100110.
1011111.

So by doing this we'll get right formation.

Nikhil Ugale said:   1 decade ago
The binary of 5 = 101.
And,
Now for the binary 0.375*2=0.750----->0 |
0.750*2=1.500----->1 |
0.500*2=1.000------>1 |


For 0.375---> 011.

Madhava Rao said:   1 decade ago
5.375 is in decimal form.
5=101(In binary format).

Now we have to convert 0.375 into binary format as below.

0.375 * 2 = 0.750 ---> 0 (take the before .(dot) value .i.e Integer value).
0.750 * 2 = 1.500 ---> 1 (take the before .(dot) value .i.e Integer value).

*Note: if we got 1. Some value then remove the 1 value .i.e 0.500.

0.500 * 2 = 1.000 ---> 1 (take the before .(dot) value .i.e Integer value).

*Note: The above Process will be continue until we got fractional part will be getting 0(zero).

So,
0.375 = 011.

So,
5.375 = 101.011.

Bandi koushik said:   1 decade ago
5.375

5 --> 101.

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

Consider decimals from top to bottom (0 1 1).

THEREFORE, 5.375=101.011.
(1)


Post your comments here:

Your comments will be displayed after verification.