This is a strange function!
One example is the Dirichlet function \(1_{\mathbb{Q}}\).
\(1_{\mathbb{Q}}(x)=1\) if \(x \in \mathbb{Q}\) and
\(1_{\mathbb{Q}}(x)=0\) if \(x \in \mathbb{R} \setminus \mathbb{Q}\).
\(1_{\mathbb{Q}}\) is everywhere discontinuous because \(\mathbb{Q}\) is everywhere dense in \(\mathbb{R}\).
The function \(x \mapsto x \cdot 1_{\mathbb{Q}}(x)\) is continuous in \(0\) and discontinuous elsewhere.
It is a good Mathematical example… the effective computability of the function is indeed another story!
Is this really a good example ? We are unable to compute the Dirichlet function for many numbers, such as the euler gamma constant or cos(ln(sin(exp(pi))))…