I don't what's wrong with this but the result is always 0.0

#include "poly.h"

#include <math.h>

/*

* polyEval: Evaluates p(x) = a[0] + a[1] * x + ... + a[n] * x^n.

* Pre: n >= 0 and array a[] has at least n+1 elements.

*/

double polyEval(double *a, int n, double x)

{

int i; /* counter for the array */

double sum=0.0;

for (i=0; i<=n; i++){

sum+= a[i]*pow(x,i);}

return sum;

}

/*

* sinePoly: Evaluates sin(x) using the first numTerms (nonzero) terms of

* its infinite series.

* Pre: 1 <= numTerms <= MAXTERMS.

*/

double sinePoly(double x, int numTerms)

{

double a[MAXTERMS];

while (numTerms >= 0){

a[numTerms]=*blah calculations*;

numTerms--;

}

return polyEval(a, numTerms, x);

}