Horner's rule for polynomial evaluation: Difference between revisions

Content deleted Content added
No edit summary
Line 1,730: Line 1,730:
ENDFUNC
ENDFUNC
</lang>
</lang>

=={{header|VBScript}}==
<lang vb>
Function horners_rule(coefficients,x)
accumulator = 0
For i = UBound(coefficients) To 0 Step -1
accumulator = (accumulator * x) + coefficients(i)
Next
horners_rule = accumulator
End Function

WScript.StdOut.WriteLine horners_rule(Array(-19,7,-4,6),3)
</lang>

{{Out}}
<pre>128</pre>


=={{header|XPL0}}==
=={{header|XPL0}}==