Documentation
Bits, masks, and number bases.
Use the Programmer functions panel beneath Scientific functions, or type the same operations directly into an expression.
Combine and inspect bits
Expand Programmer functions, which starts collapsed beneath Scientific functions. Both panels remember their open state; the up/down controls swap their order. AND, OR, XOR, and NOT work with exact integers. These examples return 8, 14, 6, and 240.
AND(12, 10)
OR(12, 10)
XOR(12, 10)
NOT(15, 8)
Open the built-in reference
Select the information button beside Programmer functions to see examples on separate lines, followed by guidance on signed operations, optional word sizes, conversions, and exact integer limits.
Shift a value
SHL shifts left without wrapping. SHR performs a signed arithmetic right shift. USHR treats the input as an unsigned word before shifting; its word width defaults to 32 bits.
SHL(1, 8)
SHR(-8, 1)
USHR(-1, 1, 8) Convert between bases
HEX, BIN, and OCT format a value with a base prefix. DEC converts prefixed values or quoted digits in an explicit base back to decimal.
HEX(255)
BIN(10)
OCT(493)
DEC("FF", 16)
HEX(-1, 8) Keep integer calculations exact
Programmer functions reject fractional values and integers outside the safe range −9,007,199,254,740,991 through 9,007,199,254,740,991. They do not silently truncate every operation to 32 bits.
- Use 0x, 0b, and 0o prefixes for hexadecimal, binary, and octal literals.
- DEC with an explicit base accepts bases 2 through 36.
- A result outside the safe integer range produces an error.
- The same engine functions can be used through authorized MCP calculation tools.