MCPcopy Create free account
hub / github.com/VCVRack/Rack / polyHorner

Function polyHorner

include/dsp/approx.hpp:39–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37*/
38template <typename T, size_t N>
39T polyHorner(const T (&a)[N], T x) {
40 if (N == 0)
41 return 0;
42
43 T y = a[N - 1];
44 for (size_t n = 1; n < N; n++) {
45 y = a[N - 1 - n] + y * x;
46 }
47 return y;
48}
49
50/** Evaluates a polynomial with coefficients `a[n]` at `x`.
51Uses Estrin's method.

Callers 1

exp2_taylor5Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected