...what about the numbers to the right of the radix point?
You simply group them into groups of four digits, just the same as you will group digits to the left of the radix point, and translate each group of four binary digits into a single hexadecimal digit.
With digits to the left, you include leading zeroes as necessary to complete the groupings of four digits. With digits to the right, include trailing zeroes as necessary.
I'll work a different problem, leaving your particular example () for you to do yourself:
In binary:
$1010111.011$
With groupings of four binary digits each:
$(0101)(0111).(0110)$
Converted to hexadecimal:
How to convert decimal to hexadecimal?
Divide the number repeatedly by 16 until the quotient is 0. Note down the remainder in each step. Once the quotient is 0, write the remainders in the reverse order to get the equivalent hexadecimal number.
What is the difference between a hexadecimal system and an octal system?
We use the base of a hexadecimal system as 16. Each digit is 16 times more significant than the previous digit. We use the base of a binary system as 8. Each digit is 8 times more significant than the previous digit. of a binary system as 2. Each digit is 2 times more significant than the previous digit.
Each 4 bits of a binary number represents a hexadecimal digit. So the best way to convert from binary to hexadecimal is to pad the binary number with leading zeroes so that the number of bits is divisible by four.
Then you process four bits at a time and convert them to a single hexadecimal digit:
0000 -> 0
0001 -> 1
0010 -> 2
....
1110 -> E
1111 -> F
No, you don't convert to decimal and then to hexadecimal, you convert to a numeric value, and then to hexadecimal.
(Decimal is also a textual representation of a number, just like binary and hexadecimal. Although decimal representation is used by default, a number doesn't have a textual representation in itself.)
As a hexadecimal digit corresponds to four binary digits you don't have to convert the entire string to a number, you can do it four binary digits at a time.
First fill up the binary number so that it has full groups of four digits:
000101101001.1011101010100110
Then you can convert each group to a number, and then to hexadecimal:
0001 0110 1001.1011 1010 1010 0110
169.BAA6
Alternatively, you can split the number into the two parts before and after the period and convert those from binary. The part before the period can be converted stright off, but the part after has to be padded to be correct.
Example in C#:
string binary = "101101001.101110101010011";
string[] parts = binary.Split('.');
while (parts[1].Length % 4 != 0) {
parts[1] += '0';
}
string result =
Convert.ToInt32(parts[0], 2).ToString("X") +
"." +
Convert.ToInt32(parts[1], 2).ToString("X");