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)
The expanded Programmer functions panel beneath Scientific functions, with HEX(255) returning 0xFF.
In the appExpand Programmer functions for masks, shifts, and number-base conversions. The arrow buttons change the panel order.Select the screenshot to enlarge it.

The expanded Programmer functions panel beneath Scientific functions, with HEX(255) returning 0xFF.

The expanded Programmer functions panel beneath Scientific functions, with HEX(255) returning 0xFF.

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.

The Programmer functions information popup, showing separate example lines and spaced sections for bitwise behavior, word sizes, conversions, and the exact integer range.
In the appOpen the information button beside Programmer functions for a compact reference while calculating.Select the screenshot to enlarge it.

The Programmer functions information popup, showing separate example lines and spaced sections for bitwise behavior, word sizes, conversions, and the exact integer range.

The Programmer functions information popup, showing separate example lines and spaced sections for bitwise behavior, word sizes, conversions, and the exact integer range.

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.