Ethiopian multiplication: Difference between revisions

Content added Content deleted
(Use separate functions for doubling, halving, and checking if a number is even)
(Correct parameter type)
Line 1,453: Line 1,453:
Ethiopian Multiplication is another name for the peasant multiplication:
Ethiopian Multiplication is another name for the peasant multiplication:


<lang seed7>const proc: double (in var integer: a) is func
<lang seed7>const proc: double (inout integer: a) is func
begin
begin
a *:= 2;
a *:= 2;
end func;
end func;


const proc: halve (in var integer: a) is func
const proc: halve (inout integer: a) is func
begin
begin
a := a div 2;
a := a div 2;