Horner's rule for polynomial evaluation: Difference between revisions
Content deleted Content added
Erlang |
→{{header|AutoHotkey}}: ++ algol68(g) |
||
Line 20:
C.f: [[Formal power series]]
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G}}
<lang algol68>PROC horner = ([]REAL c, REAL x)REAL :
(
REAL res := 0.0;
FOR i FROM UPB c BY -1 TO LWB c DO
res := res * x + c[i]
OD;
res
);
main:(
[4]REAL coeffs := (-19.0, 7.0, -4.0, 6.0);
print( horner(coeffs, 3.0) )
)</lang>
=={{header|AutoHotkey}}==
<lang autohotkey>Coefficients = -19, 7, -4, 6
|