Approximating a continuous real valued function with a rational valued function on $\mathbb Q$ Let $f:\mathbb R \to \mathbb R$ be a continuous function. Can we find a continuous function $f_\epsilon:\mathbb R\to \mathbb R$ s.t. $f(\mathbb Q) \subset \mathbb Q$ and $\lVert f - f_\epsilon\rVert_\infty < \epsilon$?
If we drop the continuity requirement, then we can use $\epsilon' \left\lfloor f(x)/\epsilon'\right\rfloor$ for some rational $\epsilon' < \epsilon$. But I feel like continuity is achievable, maybe under stronger conditions.
 A: I think this might be possible. The Stone-Weierstrass theorem (or just its predecessor the Weierstrass Theorem) tells us that polynomials are dense with respect to the $\|\cdot\|_\infty$-norm in the space of continuous functions $I\rightarrow \mathbb{R}$, where $I$ is a closed and bounded interval. Polynomials obviously take rationals to rationals. 
So for $f$ and $\varepsilon$ in your question you can come up with a function $g:\mathbb{R}\rightarrow \mathbb{R}$, such that, on any interval $[n,n+1)$, $g$ is a polynomial $p_n$ that satisfies $\|f-p_n\|_\infty<\varepsilon/4$. So this function $g$ is as close to $f$ as you want it and discontinuous in at most countably many points, namely $\mathbb{N}$. 
Now my idea is that on neighborhoods around those points one should be able to alter the function to make it continuous while maintaining the other properties we want.
Namely for any $n\in\mathbb{N}$ since $f$ is continuous at $n$ there is $0<\delta<1/2$ such that, for any $x\in [n-\delta, n+\delta]=[a,b]$, $|f(x)-f(n)|<\varepsilon/4$. Now change $g$ to $g'$ equal to the former except that, in the interval $[a, b]$, it is a linear function with $g'(a)=g(a)$ and $g'(b)=g(b)$. Again this function takes rationals to rationals. Moreover, for any $x\in (a,b)$, $f(n)-\varepsilon/2<f(a)-\varepsilon/4<g(a) \leq g'(x) \leq g(b)<f(b)+\varepsilon/4<f(n)+\varepsilon/2$. It follows that $|f(x)-g'(x)|<|f(x)-f(n)|+|f(n)-g'(x)|<\varepsilon$. Finally this function is clearly continuous. Do this for every $n\in\mathbb{N}$ that's necessary to reach the desired function.  
