Ethiopian multiplication: Difference between revisions

Content added Content deleted
m (→‎{{header|Bash}}: removed modulus from is_even to fit with the spirit of the problem)
m (→‎{{header|Bash}}: logical operations replacing "modulo loss workround")
Line 269: Line 269:
is_even() {
is_even() {
local n=$1
local n=$1
[ $(double $( halve $n ) ) -eq $n ]
[ $(( n & 1 )) -eq $n ]
}
}