Programmer Calculator
A programmer calculator interprets integers as finite binary words and performs bitwise logic. Binary, octal, decimal and hexadecimal show the same stored bits in different notations; signed and unsigned decimal interpretations depend on word size.
Mathematical foundation
1010_2=10_{10}=\mathrm A_{16}Mathematical foundation
Mathematical foundation
Set base, width and the integer
| Control / mode | Unit or choice | Meaning / validation |
|---|---|---|
| Number base | HEX / DEC / OCT / BIN | Four selectors change how the current value is displayed; DEC is the initial selection. |
| Word size | 8 bit / 16 bit / 32 bit / 64 bit | 32-bit initial size, changes unsigned truncation and signed interpretation. |
| Value in base n | text | Primary value parsed in selected base; valid word enables representations and operations. |
| Second operand / shift amount | text | Second value for AND/OR/XOR; decimal shift count for SHL/SHR. |
| Operations | AND, OR, XOR, NOT, SHL, SHR | Masked/truncated bitwise operations; share and save-image actions become available after a valid calculation. |
Perform masked bitwise operations
Select the number base, enter a valid primary integer and choose word size. Enter a second integer for AND, OR or XOR; enter a decimal shift amount from 0 to 1024 for SHL or SHR. NOT uses the first value alone. The operation updates the primary value and its displayed representations.
Representations, history and image actions
The representations show HEX, DEC unsigned, DEC signed at selected word width, OCT and BIN. Calculation history captures valid operations; Share image and Save image are enabled after a valid result. Parsing uses BigInt; operations mask their results to the current word width.
A worked AND/XOR comparison
At 8 bits, A = 1010₂ and B = 1100₂: AND yields 1000₂, XOR yields 0110₂. A labelled bit grid shows why the selected bits differ.
At 8 bits, A = 1010₂ and B = 1100₂: AND yields 1000₂, XOR yields 0110₂. A labelled bit grid shows why the selected bits differ.
Two’s-complement interpretation
At 8 bits, 11111111₂ is 255 unsigned or −1 signed. The underlying eight bits are unchanged; only the interpretation differs.
At 8 bits, 11111111₂ is 255 unsigned or −1 signed. The underlying eight bits are unchanged; only the interpretation differs.
Shift and overflow behaviour
Left shift drops bits outside the selected word, while right shift in the calculator operates on an unsigned-normalized value. Use the mask diagram to understand why shifting 8-bit 10000000₂ left once yields 00000000₂.
Left shift drops bits outside the selected word, while right shift in the calculator operates on an unsigned-normalized value. Use the mask diagram to understand why shifting 8-bit 10000000₂ left once yields 00000000₂.
Quick answers
What is the default word size?
32 bits.
Are signed and unsigned DEC both displayed?
Yes. The representations show both interpretations for the selected width.
What shift amounts are accepted?
A whole number from 0 to 1024; bitwise results are masked to the selected width.
Can I save a calculation image?
Yes, after a valid operation result, Share image and Save image are enabled.
