Determining if a map on a space is continuous by checking on a dense subset I recently read a proof of something my calculus teacher had told me, namely that the set of continuous maps $f: \mathbb{R} \to \mathbb{R}$ had the cardinality of $\mathbb{R}$. The proof was simple enough: There must be at least that many, as it includes all constant maps, but can be no more because we can injectively map the continuous maps on $\mathbb{R}$ to $\mathbb{R}^{\mathbb{Q}}$ by $\phi : f \mapsto (f(q))_{q \in \mathbb{Q}}$, and $\mathbb{R}^{\mathbb{Q}}$ has the same cardinality as $\mathbb{R}$, as this is enough to determine the value of $f$ on any real value by taking $f(x) = \lim_{q \to x, q \in \mathbb{Q}} f(q)$; that is, assuming the map is continuous.
But there's also the following: Let $g: \mathbb{Q} \to \mathbb{R}$ be given by
\begin{align*}
g(x) & = \begin{cases}
0, & x < \sqrt{2} \\
1, & x > \sqrt{2} .
\end{cases}
\end{align*}
Then $g$ is continuous on $\mathbb{Q}$, but does not extend to a continuous map on $\mathbb{R}$. So my question is: Is there a way to determine if a map $g : \mathbb{Q} \to \mathbb{R}$ extends to a continuous map $f: \mathbb{R} \to \mathbb{R}$?
Thanks.

It is necessary and sufficient that for any Cauchy sequence $\{x_n\}$ of rational numbers, the sequence of $\{f(x_n)\}$ is also Cauchy.
Since the real numbers are the completion of the rational numbers, if a sequence in the rational numbers converges (i.e., is Cauchy), then it converges to a real number, and you need the values of $f$ to converge as well (so it must also be Cauchy).
