-lm
with gcc flags.errno
to zero, and make the following call feclearexcept(FE_ALL_EXCEPT);
before calling a mathematical function. Upon return from the mathematical function, if errno
is nonzero, or the following call returns nonzero fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW);
then an error occurred in the mathematical function. Read manpage of math_error for more information.