Associated Topics || Dr. Math Home || Search Dr. Math

### Converting Decimal Numbers from Base 2 to Base 8 or 16

```Date: 02/20/2009 at 10:49:37
From: James
Subject: converting binary with decimal points to hexadecimal and oct

My question is about for example 111011001010000.1010101111 and
converting it to hex and octal.  I can get the 7650 and 73120
respectively for hex and oct for the number to the left of the
decimal, but for the right of the decimal point i'm not sure if i add
zeroes to the right or left side of my equation.

For example, 111 011 001 010 000 equals octal 73120 for the integer.
My question is if the right side of the decimal .1010101111 breaks
down to 101 010 111 1000 = .5274 or 001 010 101 111= .1257?

```

```
Date: 02/20/2009 at 20:33:30
From: Doctor Peterson
Subject: Re: converting binary with decimal points to hexadecimal and oct

Hi, James.

Think about WHY we can group binary digits to form octal digits.

For integers, it works like this, taking 101011 as an example.  This
means

1*2^5 + 0*2^4 + 1*2^3 + 0*2^2 + 1*2^1 + 1*2^0

If we group these in threes, we get

(1*2^5 + 0*2^4 + 1*2^3) + (0*2^2 + 1*2^1 + 1*2^0) =

(1*2^2 + 0*2^1 + 1*2^0)*2^3 + (0*2^2 + 1*2^1 + 1*2^0)*2^0 =

5*2^3 + 3*2^0 =

5*8^1 + 3*8^0    (since 8 = 2^3)

which is 53 (octal).

1*2^-1 + 0*2^-2 + 1*2^-3 + 0*2^-4 + 1*2^-5 + 1*2^-6 =

(1*2^-1 + 0*2^-2 + 1*2^-3) + (0*2^-4 + 1*2^-5 + 1*2^-6) =

(1*2^2 + 0*2^1 + 1*2^0)*2^-3 + (0*2^2 + 1*2^1 + 1*2^0)*2^-6 =

5*2^-3 + 3*2^-6 =

5*8^-1 + 3*8^-2    (since 8 = 2^3)

which is .53 (octal).

So we group starting at the radix point in either direction:

111 011 001 010 000.101 010 111 1...
7   3   1   2   0 . 5   2   7

Incidentally, if you forget this, you can just try a simple number
octal, whatever octal value we get has to be equal to 2 1/2  = 2.5
(decimal); the answer that fits this is 010.100 = 2.4 (octal) = 2 4/8.

If you have any further questions, feel free to write back.

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 02/20/2009 at 23:11:25
From: James
Subject: Thank you (converting binary with decimal points to

Just wanted to say thanks and that you were very helpful
in clearing up my confusion on the subject.
James
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search