Anonymous user
Horner's rule for polynomial evaluation: Difference between revisions
Horner's rule for polynomial evaluation (view source)
Revision as of 08:55, 3 January 2012
, 12 years ago→{{header|Ada}}: -- fixed indention and capitalization to conventions in the Ada community
(CoffeeScript) |
m (→{{header|Ada}}: -- fixed indention and capitalization to conventions in the Ada community) |
||
Line 21:
Cf. [[Formal power series]]
=={{header|Ada}}==
<lang Ada>with Ada.Float_Text_IO; use Ada.Float_Text_IO;▼
▲with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure
Res := Res*Val + Coeffs(P);
end Horner;
▲ function horner(coeffs: Coef; val: Float) return Float is
▲ res : Float := 0.0;
▲ begin
▲ for p in reverse coeffs'Range loop
▲ end loop;
▲ return res;
begin
end
</lang>
Output:
<pre>128.0</pre>
=={{header|Aime}}==
<lang aime>real
|