584 Basic integer arithmetic
Examples of integer arithmetic
The operands in integer arithmetic can be of the same base or of
mixed bases.
Mixed-base arithmetic
With one exception, where you
have operands of different
bases, the result of the
calculation is presented in the
base of the first operand. The
example at the right shows two
equivalent calculations: the first
multiplies 4
10
by 57
10
and the
second multiplies 57
10
by 4
10
. Obviously the results too are
mathematically equivalent. However, each is presented in the
base of the operand entered first: 16 in the first case and 8 in the
second.
The exception is if an operand is
not marked as an integer by
preceding it with #. In these
cases, the result is presented in
base 10.
Integer calculation Decimal equivalent
#10000b+#10100b
=#100100b
16 + 20 = 36
#71o–#10100b =
#45o
57 – 20 = 37
#4Dh * #11101b = #8B9h 77 × 29 = 2233
#32Ah/#5o = #A2h 810/5 = 162