You are here: PBASIC Language Reference > PBASIC Operators > Binary Operators

Binary Operators

 

Binary operators require two arguments. Click on any operator in the list below for details and examples.

(See also: Unary Operators and Operator Precedence.)

Notes about the 16-bit workspace

Many of the operator descriptions will say something like "computes (some function) of a 16-bit number." This does not mean that the operator does not work on smaller byte or nibble values, but rather that the computation is done in a 16-bit workspace. If the value is smaller than 16 bits, the BASIC Stamp pads it with leading 0s to make a 16-bit value. If the 16-bit result of a calculation is to be packed into a smaller variable, the higher-order bits are discarded (truncated).

+   (Addition)
-   (Subtraction)
*   (Multiplication)
**   Multiply High (Return Upper 16 Bits)
*/   Multiply Middle (Return Middle 16 Bits)
/   (Division)
// (Modulus—Remainder of Division)
MIN   (Limit a Value to Specified Low)
MAX   (Limit a Value to a Specified High)
DIG   (Returns Specified Digit of Number)
REV   (Reverses specified number of bits)
<<   (Shifts Bits Left by Specified Amount)
>>   (Shift Bits Right by Specified Amount)
&   (Bitwise AND)
|   (Bitwise OR)
^   (Bitwise XOR)
&/   (Bitwise AND NOT)
^/   (Bitwise XOR NOT)
AND   (Logical AND)
OR   (Logical OR)
XOR   (Logical XOR)
ATN   (Returns Arctangent of Vector (X, Y))
HYP   (Returns Hypotenuse)

 

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012