Differentiation of a function $f:\mathbb{Q}\to \mathbb{Q}$(Rational Calculus)

Assume that $f:\mathbb{Q}\to \mathbb{Q}$ is given such that $\forall a\in \mathbb{Q}$ the following limit, exists

\begin{equation} \lim_{x\to a} \frac{f(x)-f(a)}{x-a}\in \mathbb{R} \end{equation}

Is it true to say that the above limit is a rational number?


It is false: I would define something piecewise-constant and discontinuous at irrational $x$ such as $f : \mathbb{Q} \to \mathbb{Q}$ by:

$f(x) = 1$ for $x > \frac{1}{\sqrt{2}}$

$f(x) = \frac{1}{2}$ for $\frac{1}{3\sqrt{2}}<x<\frac{1}{2\sqrt{2}}$

$f(x) = \frac{1}{3}$ for $\frac{1}{4\sqrt{2}}<x<\frac{1}{3\sqrt{2}}$, and so on for positive $x$, and $f(0) = 0$.

Similarly for negative $x$ define:

$f(x) = -1$ for $x < -\frac{1}{\sqrt{2}}$

$f(x) = -\frac{1}{2}$ for $-\frac{1}{2\sqrt{2}}<x<-\frac{1}{3\sqrt{2}}$

$f(x) = -\frac{1}{3}$ for $-\frac{1}{3\sqrt{2}}<x<-\frac{1}{4\sqrt{2}}$ and so on. Then $f$ is differentiable (since constant) at all rational $x$ other than 0, and $f'(0) = \sqrt{2}$.