576 Basic Integer arithmetic
represents 228
10
. In this case, the base marker h indicates that the
number is to interpreted as a hexadecimal number: E4
16
.
Note that with integer arithmetic, the result of any calculation that
would return a remainder in floating-point arithmetic is truncated:
only the integer portion is presented. Thus #100b/#10b gives the
correct answer: #10b (since 4
10
/2
10
is 2
10
). However, #100b/
#11b gives just the integer component of the correct result: #1b.
Note too that the accuracy of integer arithmetic can be limited by
the integer wordsize. The wordsize is the maximum number of bits
that can represent an integer. You can set this to any value
between 1 and 64. The smaller the wordsize, the smaller the
integer that can be accurately represented. The default wordsize
is 32, which is adequate for representing integers up to
approximately 2 × 10
9
. However, integers larger than that would
be truncated, that is, the most significant bits (that is, the leading
bits) would be dropped. thus the result of any calculation
involving such a number would not be accurate.
The default base
Setting a default base only affects the entry and display of
numbers being used in integer arithmetic. If you set the default
base to binary, 27 and 44 will still be represented that way in
Home view, and result of those numbers being added will still be
represented as 71. However, if you entered #27b, you would get
a syntax error, as 2 and 7 are not integers found in binary
arithmetic. You would have to enter 27 as #11011b (since
27
10
=11011
2
).
Setting a default base means that you do not always have to
specify a base marker for numbers when doing integer arithmetic.
The exception is if you want to include a number from the non-
default base: it will have to include the base marker. Thus if your
default base is 2 and you want to enter 27 for an integer
arithmetic operation, you could enter just #11011 without the b
suffix. But if you wanted to enter E4
16
, you need to enter it with the
suffix: #E4h. (The HP Prime adds any omitted base markers when
the calculation is displayed in history.)