Continuous function changing sign on Cantor set Let $C$ be the Cantor set. I can easily define a continuous function on $[0,1]$ whose set of zeros is exactly $C$, i.e. $x\mapsto d(x,C)$.
In addition to being 0 on $C$, I'd like to build one that changes sign at each point of $C$. It seems intuitively feasible but I can't find one. Any help is appreciated. 

Let $C$ be any nowhere dense closed subset of $\mathbb R$. Define $f:\mathbb R\to\mathbb R$ as follows:
$$f(x)=\begin{cases}
0\text{ if }x\in C,\\
d(x,C)\cdot\sin\frac1{d(x,C)}\text{ if }x\notin C,\\
\end{cases}$$
where $d(x,C)$ is the distance from $x$ to $C$. The function $f$ is continuous, and it takes both positive and negative values in every neighborhood of each point of $C$.
