math_error(7) Miscellaneous Information Manual math_error(7) math_error - #include #include #include (, -1 NULL). , , , , . : -- errno; -- ( feclearexcept(3) fetestexcept(3) ), fenv(3). , , errno feclearexcept(FE_ALL_EXCEPT); , . , errno , ( fenv(3)) fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW); . . , , , (, log(3)). , , NaN ( ); errno EDOM <> (FE_INVALID). , (, 0 ). ( ) HUGE_VAL, HUGE_VALF HUGE_VALL, -- double, float long double. . errno ERANGE <> (FE_DIVBYZERO). , . , . , , . HUGE_VAL, HUGE_VALF HUGE_VALL, , -- double, float long double. errno ERANGE <> (FE_OVERFLOW). A floating result underflows if the result is too small to be represented in the result type. If an underflow occurs, a mathematical function typically returns 0.0 (C99 says a function shall return "an implementation-defined value whose magnitude is no greater than the smallest normalized positive number in the specified type"). errno may be set to ERANGE, and an "underflow" (FE_UNDERFLOW) floating-point exception may be raised. , . -- , , (. ., 1 ). . The math_errhandling identifier specified by C99 and POSIX.1 is not supported by glibc. This identifier is supposed to indicate which of the two error-notification mechanisms (errno, exceptions retrievable via fetestexcept(3)) is in use. The standards require that at least one be in use, but permit both to be available. The current (glibc 2.8) situation under glibc is messy. Most (but not all) functions raise exceptions on errors. Some also set errno. A few functions set errno, but don't raise an exception. A very few functions do neither. See the individual manual pages for details. errno fetestexcept(3) . , , log(3) NaN ( ) ( ): double x, r; if (isnan(x) || islessequal(x, 0)) { /* Deal with NaN / pole error / domain error */ } r = log(x); ( ), C99 and POSIX.1, , . gcc(1) -fno-math-errno , , errno ( gcc(1) -ffast-math -fno-math-errno.) - fetestexcept(3). gcc(1), errno(3), fenv(3), fpclassify(3), INFINITY(3), isgreater(3), matherr(3), nan(3) info libc aereiae , Alexey , Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , ITriskTI , Max Is , Yuri Kozlov , ; GNU (GNU General Public License - GPL, 3 ) , - . - , , <>. Linux man-pages 6.8 2 2024 . math_error(7)