Binary Arithmetic Calculator Formula
Understand the math behind the binary arithmetic calculator. Each variable explained with a worked example.
Formulas Used
Sum Val
sum_val = a + bDiff Val
diff_val = a - bAnd Val
and_val = bitAnd(a, b)Or Val
or_val = bitOr(a, b)Xor Val
xor_val = bitXor(a, b)Variables
| Variable | Description | Default |
|---|---|---|
a | Number A | 42 |
b | Number B | 15 |
How It Works
Binary Arithmetic
Bitwise Operations
Example: 42 AND 15
Bitwise operations work on individual bits of the binary representation.
Worked Example
Binary operations on 42 and 15.
a = 42b = 15
- 0142 + 15 = 57
- 0242 - 15 = 27
- 0342 AND 15: 101010 AND 001111 = 001010 = 10
- 0442 OR 15: 101010 OR 001111 = 101111 = 47
- 0542 XOR 15: 101010 XOR 001111 = 100101 = 37
Ready to run the numbers?
Open Binary Arithmetic Calculator