# Isn't codomain of a function ambiguous?

I understand what domain and image of a function are, and believe those terms to be well-defined. I have read that range is ambiguous, so I avoid it.

However for any given function the image has infinitely many supersets. It seems rather arbitrary to me which one we pick to be the codomain.

Is it governed by some informal convention of mathematicians?

Clearly, $\Bbb N$, $\Bbb R$, and $\Bbb C$ are popular, hence the symbols. However if, say, $\Bbb N$ is the codomain of the floor function, than it can just as well be $\Bbb R$ or $\Bbb C$.

In case of numbers you could argue, that one should pick the most restrictive among $\Bbb N$ and $\Bbb R$ and $\Bbb C$, but what about functions that do not evaluate to numbers?

There are actually several different notions of "function" in mathematics. If you read a book about set theory, you may well see a function defined simply as a set $f$ of ordered pairs such that if $(a,b)\in f$ and $(a,c)\in f$ then $b=c$. Such a "function" has a domain (or "preimage") and an image, but no concept of codomain.
If, however, you are thinking more "categorically", a "function" consists of three things: a domain, a codomain, and the set as described above. The most immediate advantage of this approach is that function composition works out nicely in a fashion that is easy to describe: if $f\colon A \to B$ and $g\colon B \to C$, then $g\circ f\colon A \to C$. You don't have to futz around with "if the image of $f$ is a subset of the domain of $g$, then …."