Files
calc/help/isset
2017-05-21 15:38:25 -07:00

44 lines
665 B
Plaintext

NAME
isset - whether a given binary bit is set in a value
SYNOPSIS
isset(x, y)
TYPES
x real
y int
return int
DESCRIPTION
Determine if the binary bit y is set in x. If:
x
int(---) mod 2 == 1
2^y
return 1, otherwise return 0.
EXAMPLE
> print isset(9,0), isset(9,1), isset(9,2), isset(9,3)
1 0 0 1
> print isset(9,4), isset(0,0), isset(9,-1)
0 0 0
> print isset(1.25, -2), isset(1.25, -1), isset(1.25, 0)
1 0 1
> p = pi()
> print isset(p, 1), isset(p, -2), isset(p, -3)
1 0 1
LIMITS
-2^31 < y < 2^31
LIBRARY
BOOL qisset(NUMBER *x, long y)
SEE ALSO
highbit, lowbit