Successive division method for integral values: Let the decimal number be 26 so we can convert it to binary by dividing the number with the base=2 and then write the quotient and remainder as shown below and then again divide the quotient with the base till we get quotient as zero. This method is also called Double-dabble method.
Successive multiplication method for fractional values: Conversion of fraction from decimal to binary follows the following procedure: just multiply the fraction by base and integer which we get to left of the decimal point is saved
Fraction is 0.3875
0.3875 * 2 =0.7750 =0 + 0.7750 a-1=0
0.7750 * 2 =1.5500 =1 + 0.5500 a-2=1
0.5500 * 2 =1.1000 =1 + 0.1000 a-3=1
0.1000 * 2 =0.2000 =0 + 0.2000 a-4=0
And the procedure may go on till we get the fractional part as zero but this may not be possible in finite no of bits hence usually we restrict the no of bits to represent the value to a finite value and get an approximate value…
So the (0.3875)10 = 0.a-1 a-2 a-3 a-4 ……= (0.0110….) 2 = (0.0110)2
If we convert the value (0.0110)2 back to decimal
=0 * 2-1 + 1 * 2-2 + 1 * 2-3 + 0*2-4 =0 * 0.5 + 1 * 0.25 + 1 * 0.125 + 0*.0625 =0.3750 which is only approximate value of the actual value. So we see the equivalent we get in binary for a fraction may only be an approximate value. We may increase the no of bits to increase the accuracy. So the precision we get depends on the no. of bits we have chosen to represent the number. Sometimes we may get the accurate equivalent in small no of bits.
Q- Convert decimal 13.75 into binary equivalent.
Ans: We first divide the integer and the fraction part and then convert them separately into binary equivalents and then again append them with a decimal point between them as shown below:
Binary equivalent of 13 we get, with the procedure mentioned above, is 1101
And to get the binary equivalent of 0.75
0.75 * 2 =1.50 = 1 + 0.50 a-1=1
0.50 * 2 =1.00 =1+0.00 a-2=1
So we get the binary equivalent as 0.11. In this case as we have the fractional part as Zero and hence 0.11 is the exact equivalent of 0.75
Now we append the two values and get the binary equivalent of 13.75 as (1101.11) 2
Hi there this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!