TITLE: Fractions in binary?
QUESTION [24 upvotes]: How would you write a fraction in binary numbers; for example, $1/4$, which is $.25$? I know how to write binary of whole numbers such as 6, being $110$, but how would one write fractions?

REPLY [2 votes]: Not sure how helpful this is but whenever I work with binary I always use a table.
So if you want 0.25 or 15.75 (base 10) in binary:
\begin{array}{r|rrrr|rrrr}
& 8 & 4 & 2 & 1 & \frac{1}{2} & \frac{1}{4} & \frac{1}{8} & \frac{1}{16} \\
& 8 & 4 & 2 & 1 & 0.5 & 0.25 & 0.125 & 0.0625 \\
\hline
0.25 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
15.75 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0
\end{array}
Gives 0.01 and 1111.11 respectively.
And another way:
15.375 to binary for example:
\begin{align}
15 - 8 & = 7, & \quad 7 \ge 0 & \to 1 \\
7 - 4 & = 3, & 3 \ge 0 & \to 1 \\
3 - 2 & = 1, & 1 \ge 0 & \to 1 \\
1 - 1 & = 0, & 0 \ge 0 & \to 1 \\
\\
0.375 - 0.5 & = -0.125, & -0.125 \lt 0 & \to 0 \\
0.375 - 0.25 & = 0.125, & 0.125 \ge 0 & \to 1 \\
0.125 - 0.125 & = 0, & 0 \ge 0 & \to 1
\end{align}
Gives 1111.011.