Classic pitfall of C.
Just remember, the preprocessor works like an automatic copy-paster.
In your case, every occurrence of the sqrt() macro will be replaced by its definition, updated with the parameters.
One solution is to use parentheses, like guestgulkan already explained.
Another is to use an inline function, or a template function.