PLAYGROUND (experimental)

bit_parity

Returns 1 if n has an odd number of set bits, 0 otherwise.
bit_parity(
    n
) -> NUMBER

Returns 1 if n has an odd number of set bits, 0 otherwise.

Syntaxe

var result = bit_parity(5);  // Returns 0 (binary 101 has 2 bits, even)

Arguments

NameTypeRequiredDefaultDescription
nyes-Number (int/float), hex string (0x... #...), or binary string (0b...)