Standard Math
suggest changeSyntax
- #include <math.h>
- double pow(double x, double y);
- float powf(float x, float y);
- long double powl(long double x, long double y);
Remarks
powis in C89.powfandpowlwere added in C99. On many Unix-like systems,gccneeds-lmto link the math library. That flag is not an ISO C requirement.- A portable check sets
errnoto zero and callsfeclearexcept(FE_ALL_EXCEPT)before the math call. After the call, an error is reported iferrnois nonzero or iffetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)is nonzero. Those floating-environment calls are reliable only when<fenv.h>is included and#pragma STDC FENV_ACCESS ONis in effect. Which oferrnoand the exception flags an implementation uses is given bymath_errhandling. See themath_errormanual on systems that provide it.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents