Convert non-integer decimal to octal
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&hellip;, and some numbers have two expansions, for example 251.5625 = 251.562499999&hellip;.

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.

In your case, notice that 251.5625 = 4025/24. This shows that your number has a terminating expansion in any even basis, and in particular in base 8 (octal) and base 16 (hexadecimal). There are known algorithms to convert between bases, that you can find off the internet.

If you already know how to convert integers among bases, then you really also know how to convert non-integers, as long as they have a terminating expansion in the target base. To illustrate the method, consider the number 2.25. We want to convert it to base 4. Note that 2.25=9/4. Now 9 in base 4 is 214 (the subscript is how we indicate the base), and so 9/4 in base 4 is 2.14, since moving the decimal mark one digit to the left (from 21. to 2.1) is tantamount to dividing by the base (similarly, moving it to right corresponds to multiplying by the base).

Hopefully this theoretical information suffices for your problem.