Decimal to Octal:
Let the decimal number be 26 so we can convert it to octal by dividing the number with the base=8 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 Oct-dabble method.
Conversion of fraction from decimal to octal is similar to the one for binary and follows the following procedure: just multiply the fraction by base=8 and integer which we get to left of the decimal point is saved
Fraction is 0.3875
0.3875 * 8 =3.1000 =3 + 0.1000 a-1=3
0.1000 * 8 =0.8000 =0 + 0.8000 a-2=0
0.8000 * 8 =6.4000 =6 + 0.4000 a-3=6
0.4000 * 8 =3.2000 =3 + 0.2000 a-4=3
And let me re-write the same facts about the procedure followed above. It 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.3063….) 8 = (0.3063)8
If we convert the value (0.3063)2 back to decimal
=3 * 8-1 + 0 * 8-2 + 6 * 8-3 + 3 *8-4 =0.3777 which is only approximate value of the actual value. So we see the equivalent we get in nay number system for a fraction may only be an approximate value. The same again that we may increase the no of bits to increase the accuracy.
Decimal to Hexadecimal: following the same procedure
Convert 26 decimal to hexadecimal: This method is also called Hex-dabble method.
Convert 0.3875 to hexadecimal
We can convert a fraction from a decimal to hexadecimal form by multiplying wit base and following the same procedure.
Fraction is 0.3875
0.3875 * 16 =6.2000 =6 + 0.2000 a-1=6
0.2000 * 16 =3.2000 =3 + 0.2000 a-2=3
0.2000 * 16 =3.2000 =3 + 0.2000 a-3=3
Similarly a-4=3, a-5=3, a-6=3 so on…….
Hence the hexadecimal equivalent is 0.63333…