## Help! I am getting wrong output

-------Poly.c--------------
#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=1.0;

for (i=0; i<=n; i++){
sum+= a[i];}
return sum;
}

-------Sine.c---------------
/*
* sinePoly: Evaluates sin(x) using the first numTerms (nonzero) terms of
* its infinite series.
* sin(x) = x - x^3/3! + x^5/5! - x^7/7! + x^9/9! - x^11/11! + ...
* Pre: 1 <= numTerms <= MAXTERMS.
*/
double sinePoly(double x, int numTerms)
{
double a[MAXTERMS];
int i;
double numer=0.0;
double denom=0.0;

for (i=0; i<=numTerms; i++){
numer=pow(x,(2*i+1));
denom=fabs(2*i+1);
a[i]=(pow((-1),i)*(numer/denom));
}
return polyEval(a, numTerms, x);
}

----testsine.c-----
/*
* Program that allows a programmer to test the functions in sine.h */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "sine.h"

int main()
{
int numTerms;
double x, sinexPoly,

/* read x and number of terms */
scanf("%lf", &x);
scanf("%d", &numTerms);

/* compute sine(x) and output results */
sinexPoly = sinePoly(x, numTerms);

printf("x =%22.15g, numTerms = %d\n", x, numTerms);
printf("Not Range Reduced:%22.15e\n", sinexPoly);

return 0;}