Khangai Robot Play - Naive  01
THe naive play of the Khangai Robot
polynomial.h
Go to the documentation of this file.
1 /*
2  * polynomial.h
3  *
4  * Created : 24/2/2019
5  * Author : n-is
6  * email : 073bex422.nischal@pcampus.edu.np
7  */
8 
9 #ifndef _POLYNOMIAL_H_
10 #define _POLYNOMIAL_H_
11 
12 template <size_t N>
13 float polyval(float (&poly)[N], float indep)
14 {
15  float val = 0;
16  float last_indep = 1;
17 
18  for (size_t i = 0; i < N; ++i) {
19  val += poly[i] * last_indep;
20  last_indep *= indep;
21  }
22 
23  return val;
24 }
25 
26 #endif // !_POLYNOMIAL_H_
float polyval(float(&poly)[N], float indep)
Definition: polynomial.h:13