pow(3) Library Functions Manual pow(3) pow, powf, powl - LIBRARY Math library (libm, -lm) #include double pow(double x, double y); float powf(float x, float y); long double powl(long double x, long double y); glibc (. feature_test_macros(7)): powf(), powl(): _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || /* glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE x, y. x, y. , , HUGE_VAL, HUGE_VALF HUGE_VALL, , . If result underflows, and is not representable, a range error occurs, and 0.0 with the appropriate sign is returned. x +0 -0 y -- 0, HUGE_VAL, HUGE_VALF HUGE_VALL x. x + -0 y -- 0 , +HUGE_VAL, +HUGE_VALF +HUGE_VALL. x +0 (-0) y -- 0, +0 (-0). x 0 y 0 , +0. x -1 y , 1.0. x +1, 1.0 ( y NaN). y 0, 1.0 ( x NaN). x -- 0 y -- , , NaN. x 1 y , . x 1 y , +0. x 1 y , +0. x 1 y , . x y -- 0, -0. x y -- 0 , +0. x y -- 0, . x y -- 0 , . x y -- 0, +0. x y -- 0, . Except as specified above, if x or y is a NaN, the result is a NaN. math_error(7), , . : : x y errno EDOM. (FE_INVALID). : x y errno ERANGE ( ). (FE_DIVBYZERO). : errno ERANGE. (FE_OVERFLOW). : errno ERANGE. (FE_UNDERFLOW). attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |pow(), powf(), powl() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ C11, POSIX.1-2008. C99, POSIX.1-2001. , double, SVr4, 4.3BSD, C89. Historical bugs (now fixed) Before glibc 2.28, on some architectures (e.g., x86-64) pow() may be more than 10,000 times slower for some inputs than for other nearby inputs. This affects only pow(), and not powf() nor powl(). This problem was fixed in glibc 2.28. A number of bugs in the glibc implementation of pow() were fixed in glibc 2.16. In glibc 2.9 and earlier, when a pole error occurs, errno is set to EDOM instead of the POSIX-mandated ERANGE. Since glibc 2.10, glibc does the right thing. In glibc 2.3.2 and earlier, when an overflow or underflow error occurs, glibc's pow() generates a bogus invalid floating-point exception (FE_INVALID) in addition to the overflow or underflow exception. . cbrt(3), cpow(3), sqrt(3) Alexey, Azamat Hackimov , kogamatranslator49 , Kogan, Max Is , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . pow(3)