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 2 of 8.
Vishal said:
1 decade ago
5.375
5 --> 101
0.375 * 2 = 0.75
0.75 * 2 = 1.5
0.5 * 2 = 1.0
Consider,only the decimal part from top to bottom ( 0 1 1)
THEREFORE, 5.375=101.011
5 --> 101
0.375 * 2 = 0.75
0.75 * 2 = 1.5
0.5 * 2 = 1.0
Consider,only the decimal part from top to bottom ( 0 1 1)
THEREFORE, 5.375=101.011
Subbu.B said:
1 decade ago
Thank you Surya and Susmita.
Ajinkya said:
1 decade ago
For converting any Decimal Number to its equivalent Binary Number:
1) For the Integer part of the Number(Before Decimal Point):
Divide that Number by 2 (Eg. 5%2) till the quotient is 1 and note down the remainders in each division (either 0 or 1). When you reach 1, then stop and in the Remainder column, write 1 at the bottom. Then, for your integer part answer, write it from bottom to top.
2) For the Decimal part of the Number(After Decimal Point):
Multiply that Number by 2 (Eg. 0.375*2) till the answer reaches 1. But when you multiply by 2, remove the integer part of the answer and write it down in one column and then multiply the decimal part of the answer by 2 till you reach 1. And when you reach 1, then stop and your answer will be in the same order as that of the numbers that you had written in the column mentioned above.
Eg.) 5.375 : Ans.) 101.011
1) Firstly, integer part is : 5
So,
Remainder
5/2 = 1 (Bottom-Top Approach)
2/2 0
1 1
(As 1 is reached, STOP!!!)
Hence, Binary Equivalent of 5 = 101
2) Now for the Decimal Part: 0.375
Multiplication Answer
0.375*2 = 0.75 0 (Top-Bottom Approach)
0.75*2 = 1.50 1
0.50*2 = 1.00 1
(As 1 is reached, STOP!!!)
Hence, Binary Equivalent of 0.375 = 0.011
Therefore, Binary Equivalent of 5.375 = 101.011.
Hope this helps... :).
Keep Posting....
1) For the Integer part of the Number(Before Decimal Point):
Divide that Number by 2 (Eg. 5%2) till the quotient is 1 and note down the remainders in each division (either 0 or 1). When you reach 1, then stop and in the Remainder column, write 1 at the bottom. Then, for your integer part answer, write it from bottom to top.
2) For the Decimal part of the Number(After Decimal Point):
Multiply that Number by 2 (Eg. 0.375*2) till the answer reaches 1. But when you multiply by 2, remove the integer part of the answer and write it down in one column and then multiply the decimal part of the answer by 2 till you reach 1. And when you reach 1, then stop and your answer will be in the same order as that of the numbers that you had written in the column mentioned above.
Eg.) 5.375 : Ans.) 101.011
1) Firstly, integer part is : 5
So,
Remainder
5/2 = 1 (Bottom-Top Approach)
2/2 0
1 1
(As 1 is reached, STOP!!!)
Hence, Binary Equivalent of 5 = 101
2) Now for the Decimal Part: 0.375
Multiplication Answer
0.375*2 = 0.75 0 (Top-Bottom Approach)
0.75*2 = 1.50 1
0.50*2 = 1.00 1
(As 1 is reached, STOP!!!)
Hence, Binary Equivalent of 0.375 = 0.011
Therefore, Binary Equivalent of 5.375 = 101.011.
Hope this helps... :).
Keep Posting....
Jhunu said:
1 decade ago
Thanks narayan.
Shruthi kamath said:
1 decade ago
Thanks surya for clear explanation.
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).
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).
Sai said:
1 decade ago
5.375
5 --> 101
0.375 * 2 = 0.75
0.75 * 2 = 1.5
0.5 * 2 = 1.0
Consider,only the decimal part from top to bottom ( 0 1 1)
THEREFORE, 5.375=101.011
5 --> 101
0.375 * 2 = 0.75
0.75 * 2 = 1.5
0.5 * 2 = 1.0
Consider,only the decimal part from top to bottom ( 0 1 1)
THEREFORE, 5.375=101.011
Sibinxavier said:
1 decade ago
After "." it become
111= 1/2,1/4,1/8
375
011 = 0*(1/2)+1(1/4)+1(1/8)
=.25+.125 =.375
5.375 =101.011
111= 1/2,1/4,1/8
375
011 = 0*(1/2)+1(1/4)+1(1/8)
=.25+.125 =.375
5.375 =101.011
Deepika said:
1 decade ago
8421
0101 - 5(4+1)
0011 - 3(2+1)
So 5.3 = 101.011
0101 - 5(4+1)
0011 - 3(2+1)
So 5.3 = 101.011
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.
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.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers