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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
n | yes | - | Number (int/float), hex string (0x... #...), or binary string (0b...) |