C Programming - Floating Point Issues - Discussion
Discussion Forum : Floating Point Issues - General Questions (Q.No. 7)
7.
The binary equivalent of 5.375 is
Discussion:
76 comments Page 3 of 8.
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.
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
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.
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.
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.
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.
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.
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.
RAGHAVESH YADIKI 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.
By language is,
5<--1011011.
1010101.
101.1011.
1100110.
1011111.
So by doing this we'll get right formation.
Muralikrishna said:
1 decade ago
101.011 converting to decimal.
= 1*(2^2)+0*(2^1)+1*(2^0).0*(2^-1)+1*(2^-2)+1*(2^-3).
= 4+0+1.0+(1/4)+(1/8).
= 5.375 Answer.
= 1*(2^2)+0*(2^1)+1*(2^0).0*(2^-1)+1*(2^-2)+1*(2^-3).
= 4+0+1.0+(1/4)+(1/8).
= 5.375 Answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers