Skip to content

Instantly share code, notes, and snippets.

@bowbahdoe
Created June 9, 2015 23:19
Show Gist options
  • Select an option

  • Save bowbahdoe/ea3ef3dbfa10d70d3582 to your computer and use it in GitHub Desktop.

Select an option

Save bowbahdoe/ea3ef3dbfa10d70d3582 to your computer and use it in GitHub Desktop.
float evaluatePolynomial(int array[],
int arrayLength,
float xValue)
{
//Evaluates the polynomial at a given point
//So if you get passed in {1,2,3}, thats
//the same as X^2+2X+3 and {1,4,4,6,7,8}
//is X^5+4X^4+4X^3+6X^2+7X+8
//So {1,2,3},3,3.4 should return the result
//of (3.4)^2+2*(3.4)+3
}
int main()
{
//one Test Case, make your own to test other things
int array[3] = {1,2,3};
float value = evaluatePolynomial(array,3,2.3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment