PLAYGROUND (experimental)

bit_get

Return the bit at position pos of the number n (in binary).
bit_get(
    n, 
    pos, 
    [format="dec"], 
    [zeropad=0]
) -> NUMBER (0 or 1)

Return the bit at position pos of the number n (in binary).

Syntaxe

var b = bit_get(145,2);

Arguments

NameTypeRequiredDefaultDescription
nyes-Number (int/float), hex string (0x... #...), or binary string (0b...)
posyes-Position
format-"dec"Output format: 'dec', 'hex', or 'bin'
zeropad-0Zero-pad hex/bin output to this width in bits (8, 16, 32, 64), 0 for no padding