In FOL, we often have functions which take as input some elements from the domain of discourse and give us another element from the domain of discourse. I'm looking into how to use FOL in the context of mathematics: set theory, arithmetic, etc.
The problem that I've noticed is that in mathematics, we often have functions (in the sense of FOL) which only output another element in the domain of discourse for certain inputs. For example, the function sqrt(x) will give another element in the domain when x is a nonnegative number, but not when x is negative.
I've only taken logic class and we used the book Language, Proof, and Logic. In this book they said that when constructing FOL languages, we should try to make functions refer to elements in the domain of discourse for any inputs.
How does FOL handle functions that don't produce an output for certain inputs?