Source
Edit
The implementation uses Horner's rule for more efficient computation.
func p1evl[F](x: F; coef: openArray[F]; N = coef.high - 1): F
-
Evaluate polynomial when coefficient of x is 1.0. Otherwise same as polevl.
Source
Edit
func polevl[F](x: F; coef: openArray[F]; N = coef.high): F
-
Evaluates polynomial of degree N:
2 N
y = C + C x + C x +...+ C x
0 1 2 N
Coefficients are stored in reverse order:
coef[0] = C , ..., coef[N] = C .
N 0
Source
Edit
macro polExpd[F](x: F; coef: untyped): F
-
expand polynomial with coef literal as inline expression.
coef shall be literal of a serials of F surrounded by brackets, curly braces or paratheses
Example:
assert 1.0*3.0+2.0 == polExpd(1.0, (3.0, 2.0))
Source
Edit
macro polExpd0[F](x: F; rcoef: untyped): F
-
the same as polExpd except that rcoef is reversed: rcoef[0] is the C_0 constant (a.k.a. muliplied by x^0)
Source
Edit