functions differing by a constant

Let D be **a set of nonzero real numbers**. Suppose that the functions $\displaystyle g : D \rightarrow R$ and $\displaystyle h : D \rightarrow R$ are differentiable and that $\displaystyle g'(x) = h'(x)$ for all x in D. Do the functions differ by a constant???

so we can say that:

If D is an open interval then, we can define $\displaystyle f = g-h : D\rightarrow R $. then we have

$\displaystyle f'(x) = g'(x) -h'(x) = 0$ for all x in D

So, $\displaystyle f : D \rightarrow R$ is constant iff g and h differ by a constant.

however, what i wanted to know is how can we assure that D is an (open) interval?