Ethiopian multiplication: Difference between revisions

Content added Content deleted
(add AutoHotkey)
m (→‎{{header|AutoHotkey}}: changed "loop" to "while")
Line 68: Line 68:
Ethiopian( a, b ) {
Ethiopian( a, b ) {
r := (isEven(a) ? 0 : b)
r := (isEven(a) ? 0 : b)
While (a != 1) {
Loop
{
a := half(a)
a := half(a)
b := double(b)
b := double(b)
if !isEven(a)
if !isEven(a)
r += b
r += b
if (a = 1)
break
}
}
return r
return r