When we have a function $f: \mathbb{R} \to \mathbb{R}$, I can intuitively picture that and think that for every $x \in \mathbb{R}$, we can find a $y \in \mathbb{R}$ such that our function $f$ maps $x$ onto $y$.
I'm confused, however, when we have something like: $g: D \to \mathbb{R}$, where $D$ is the domain of our function such that $D \subset \mathbb{R}$. How can our function output every element in $\mathbb{R}$, when our input was specifically less than the whole set of reals?