mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.10.3t5.45
This commit is contained in:
43
help/bit
Normal file
43
help/bit
Normal file
@@ -0,0 +1,43 @@
|
||||
NAME
|
||||
bit - whether a given binary bit is set in a value
|
||||
|
||||
SYNOPSIS
|
||||
bit(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 bit(9,0), bit(9,1), bit(9,2), bit(9,3)
|
||||
1 0 0 1
|
||||
|
||||
> print bit(9,4), bit(0,0), bit(9,-1)
|
||||
0 0 0
|
||||
|
||||
> print bit(1.25, -2), bit(1.25, -1), bit(1.25, 0)
|
||||
1 0 1
|
||||
|
||||
> p = pi()
|
||||
> print bit(p, 1), bit(p, -2), bit(p, -3)
|
||||
1 0 1
|
||||
|
||||
LIMITS
|
||||
-2^31 < y < 2^31
|
||||
|
||||
LIBRARY
|
||||
BOOL qbit(NUMBER *x, long y)
|
||||
|
||||
SEE ALSO
|
||||
highbit, lowbit, digit
|
Reference in New Issue
Block a user