Horner's rule for polynomial evaluation: Difference between revisions
Content added Content deleted
Line 1,923: | Line 1,923: | ||
128 |
128 |
||
</pre> |
</pre> |
||
=={{header|Visual Basic .NET}}== |
|||
{{trans|C#}} |
|||
<lang vbnet>Module Module1 |
|||
Function Horner(coefficients As Double(), variable As Double) As Double |
|||
Return coefficients.Reverse().Aggregate(Function(acc, coeff) acc * variable + coeff) |
|||
End Function |
|||
Sub Main() |
|||
Console.WriteLine(Horner({-19.0, 7.0, -4.0, 6.0}, 3.0)) |
|||
End Sub |
|||
End Module</lang> |
|||
{{out}} |
|||
<pre>128</pre> |
|||
=={{header|Visual FoxPro}}== |
=={{header|Visual FoxPro}}== |