# Convert the decimal number 321.145 to octal and hexadecimal.

tiburtius | Certified Educator

Octal:

We take integer and decimal part separately.  We devide integer part by 8 repeatedly (until we get to 0) and write the remainder:

`321=40cdot8+1`

`40=5cdot8+0`

`5=0cdot 8+5`

Reading the remainders in reverse order we get `501` which is our integer part in octal base.

Now we multiply decimal part repeatedly and write when we get integer part:

`0.145cdot8=1.16`

`0.16cdot8=1.28`

`0.28cdot8=2.24`

`0.24cdot8=1.92`

`0.92cdot8=7.36`

`0.36cdot8=2.88`

`0.88cdot8=7.04`

`0.04cdot8=0.32`

`0.32cdot8=2.56`

`0.56cdot8=4.48`

`ldots`

Hence when we read integer parts from top to bottom we get `1121727024ldots`

So `321.145approx501.1121727024_((8))`

To get hexadecimal number we repeat everything but with 16 instead of 8.

`321=20cdot16+1`

`20=1cdot16+4`

`1=0cdot16+1`

Hence integer part is `141`.

`0.145cdot16=2.32`

`0.32cdot16=5.12`

`0.12cdot16=1.92`

`0.92cdot16=14.72`

`0.72cdot16=11.52`

`0.52cdot16=8.32`

`ldots`

Hence by reading integer parts from top to bottom we get `251EB8`. Notice that numbers greater than 9 (10,11,12,13,14,15) are written as letters (A,B,C,D,E,F). Also notice that in the last line we have 8.32 and since we already had 0.32 it means that decimals `51EB8` will reapeat (this is periodic number).

`321.145=141.2dot(5)1EBdot(8)_((16))`