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 7 of 8.
Bharath said:
1 decade ago
I did'tunderstand this can please provide a better solution.
Vinoth.M said:
1 decade ago
Convert decimal to binary(divide decimal number by 2)
->5/2 quotient=2 remainder=1
->2/2 quotient=1 remainder=0
->1/2 quotient=0 remainder=1
In decimal numbers take remainders from bottom to top so binary equivalent of decimal no 5 is 101
Then take fractional part.Here we can convert fractional no to binary by multiply it by 2
So,->0.375*2=0.750 decimal part=0
->0.750*2=1.50 decimal part=1(omit decimal part)
->0.5*2=1.0 decimal part=1
Here we take decimal part from top to bottom.So binary equivalent of 0.375 is 011
Finally 5.375->101.011
->5/2 quotient=2 remainder=1
->2/2 quotient=1 remainder=0
->1/2 quotient=0 remainder=1
In decimal numbers take remainders from bottom to top so binary equivalent of decimal no 5 is 101
Then take fractional part.Here we can convert fractional no to binary by multiply it by 2
So,->0.375*2=0.750 decimal part=0
->0.750*2=1.50 decimal part=1(omit decimal part)
->0.5*2=1.0 decimal part=1
Here we take decimal part from top to bottom.So binary equivalent of 0.375 is 011
Finally 5.375->101.011
Kittu said:
1 decade ago
Because they asked binary equivalent thats why we multiply by 2 .
Srini said:
1 decade ago
Why we multiply decimal value *2 ?
Audhil 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...congrats to surya.......this is d right way......
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...congrats to surya.......this is d right way......
Keerthi said:
1 decade ago
Thanks for clear explanation.
Narayan semwal said:
1 decade ago
5.375
1--001
2--010
3--011
4--100
5-- 101
0.375 * 2 = 0.750
0.75 * 2 = 1.500
0.5 * 2 = 1.000
Consider,only the decimal part from top to bottom ( 0 1 1)
THEREFORE, 5.375=101.011
1--001
2--010
3--011
4--100
5-- 101
0.375 * 2 = 0.750
0.75 * 2 = 1.500
0.5 * 2 = 1.000
Consider,only the decimal part from top to bottom ( 0 1 1)
THEREFORE, 5.375=101.011
Akansha Sneha said:
2 decades ago
To solve this divide the no. before decimal by 2 and write the remainder in reverse order and then multiply the no. after decimal by 2 and write the no. before decimal in the resultant in same order and do the same process until the resultant is zero.
Sagar said:
2 decades ago
Nice explanation.
Theyaguk said:
2 decades ago
Terrific Master!!
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers