Where is pow function defined and implemented in C?

user188276 picture user188276 · Nov 9, 2009 · Viewed 14.2k times · Source

I read that the pow(double, double) function is defined in "math.h" but I can't find its declaration.

Does anybody know where this function declared? And where is it implemented in C?

Reference:

http://publications.gbdirect.co.uk/c_book/chapter9/maths_functions.html

Answer

Greg Hewgill picture Greg Hewgill · Nov 9, 2009

Quite often, an include file such as <math.h> will include other header files that actually declare the functions you would expect to see in <math.h>. The idea is that the program gets what it expects when it includes <math.h>, even if the actual function definitions are in some other header file.

Finding the implementation of a standard library function such as pow() is quite another matter. You will have to dig up the source code to your C standard runtime library and find the implementation in there.