HTBasic Help
×
Menu
Index

BINCMP

Performs a bit by bit complement.
 
 BINCMP( arg )
 
Where:
arg = numeric-expression rounded to an INTEGER
 
Usage:
B=BINCMP(A)
 
Example:      BINCMP.BAS
 
Description:
The result of BINCMP(A) is calculated by first converting the value of A to an integer. The integer value of A is then treated as a binary number. Each bit of the result is set to 1 if the corresponding bit of A is 0 and is set to 0 if the corresponding bit of A is 1. Here is an example of how BINCMP works:
 
BINCMP(13)
 
The number 13 is considered a binary number, then the bitwise complement is performed:
 
13         = 0000000000001101
BINCMP(13) = 1111111111110010
 
The resulting binary number represents -14.
See Also: