# Convert non-integer decimal to octal

I follow a course in Computer Architecture and I'm making exercises on number conversions. Now one of the questions asks me to convert 251.5625 to octal and hexdecimal base. No further info is given. Would this mean that I have to convert it and just ignore the point? Or what's the convention on something like this?

• Perhaps the question is a test of your understanding the different ways of representing fractional numbers in computer architecture. As there are many different ways of representing the numbers there would be many answers. If you have only been taught one representation, then surely the answer must use that. Look at your course notes. May 1, 2016 at 11:10
• Thank you! That's indeed a possibility. We've studied the fixed point and floating point notation. So I'll try both of them. May 1, 2016 at 11:51
• @BrianTompsett-汤莱恩 Actually, there is only one common interpretation of the representation of a given real number in a given base. May 1, 2016 at 16:39

Every non-negative real number can be represented in any integer base $b \geq 2$ as a string of the form $$x_{n-1} \ldots x_0.x_{-1} x_{-2} \ldots,$$ where $x_i \in \{0,\ldots,b-1\}$, and the string is interpreted as having the value $$x_{n-1} b^{n-1} + \cdots + x_0 b^0 + x_{-1} b^{-1} + x_{-2} b^{-2} + \cdots.$$ For example, 251.5625 in base 10 is the number $$2 \times 10^2 + 5 \times 10^1 + 1 \times 10^0 + 5 \times 10^{-1} + 6 \times 10^{-2} + 2 \times 10^{-3} + 5 \times 10^{-4}.$$ (You can extend this to negative numbers as well by allowing negation, e.g. -3.)
It is a basic result of arithmetic that every non-negative real number has a base $b$ expansion. In general, every number has infinitely many expansion: for example, 251.5625 can also be written as 0251.5625 or as 251.56250. If we don't allow leading and trailing zeroes then some numbers have a unique expansion, for example 0.33333…, and some numbers have two expansions, for example 251.5625 = 251.562499999….
A number is of the second form (has two expansions) if and only if it has a terminating expansion, that is one which is finite (for example 251.5625). The only number in base $b$ with this property are those of the form $N/b^k$ for integers $N,k \geq 0$. For example, 251.5625 = 2515625/104.