Skip to content
AutomationHub
back to tool directory

Programmer's Calculator

// bin · dec · hex — convert and calculate. integers only: the floating point was moved to another server

automationhub — ~/tools/calculator --bitwise --no-float

Base Calculator

Type a number or an expression. Bare numbers are read in the selected base — 0b and 0x prefixes work in any mode. Arithmetic is integer throughout: / is integer division, ^ is bitwise XOR (not power), and ~ flips every bit. Pick a bit width to wrap results like two's complement does in C.

$ base (for bare numbers)

$ bit width (two's complement wrap)

// floats were moved to another server
output — all bases, live idle
dec
0
hex
0
bin
0

bit view — auto · amber bit is the sign

// where 0x7fffffff + 1 becomes 0x80000000 and the compiler just shrugs

history — click to reuse
  • // nothing yet. the calculator remembers everything and judges nothing

// operator precedence — top row binds tightest; parentheses always win, like always

operators name note
~ -unarybitwise NOT / negate — ~0x0f turns on every other bit
* / %arithmetic/ is integer division — truncates like C, no decimals, no mercy
+ -arithmeticthe only place + means "add"
<< >>shiftmove bits, lose the ends — shifting by ≥ width is refused (undefined behavior)
&bitwise ANDkeep what both operands agree on
^bitwise XORnot exponentiation — this is a programming calculator
|bitwise ORkeep what either operand mentions

// constants worth knowing — click a row to insert it

value decimal why you know it
0xFF255one byte of everything
0xFFFF6553516 bits, all on
0xFFFFFFFF429496729532 bits all on — that's -1 in two's complement
0x7FFFFFFF2147483647INT_MAX — the largest int is allowed to be
0x800000002147483648INT_MIN, unsigned — the loneliest number
0xDEADBEEF3735928559the classic crash signature