Math library functions and error checking

Oliver Laumann net at tub.UUCP
Fri May 4 20:40:27 AEST 1990


What is the correct method to check whether an exception (overflow,
invalid arguments, etc.) occurred during the execution of a C math
library function (such as sqrt() or sin())?

Do I have to test the result against NaN, or do I have to check errno
(EDOM)?  If the latter is true, is errno cleared automatically on
success or do I have to clear it before calling the function?

Thanks,
--
Oliver Laumann     net at TUB.BITNET     net at tub.cs.tu-berlin.de     net at tub.UUCP



More information about the Comp.lang.c mailing list