What include statement do I need to access the math functions in this C code?
unsigned int fibonacci_closed(unsigned int n) {
double term_number = (double) n;
double golden_ratio = (1 + sqrt(5)) / 2;
double numerator = pow(golden_ratio, term_number);
return round(numerator/sqrt(5));
}
I tried #include <math.h>
but that didn't seem to do it.
I'm using Visual Studio 2010 (Windows 7). This is the error:
1>ClCompile:
1> fibonacci_closed.c
1>c:\users\odp\documents\visual studio 2010\projects\fibonacci\fibonacci\fibonacci_closed.c(7): warning C4013: 'round' undefined; assuming extern returning int
1>fibonacci_closed.obj : error LNK2019: unresolved external symbol _round referenced in function _fibonacci_closed