Node:Integers, Next:Fractions, Up:Numbers
Integers can be arbitrarily large.
A fairly complete set of operations on Integers has been implemented.
Other bases than 10 can be specified with the r
prefix:
Q1> 16rff 255For convenience, the
0x
prefix used in C is also recognized
as being the same as 16r
:
Q2> 0xFF 255But a
0
prefix does not indicate an octal number:
0177 = 177
The variable print_base
controls the base used for output:
Q3> print_base:=16 Q4> 255 FF Q5> print_readable:=1 Q6> 255 0xFF Q7> print_base:=8 Q8> 255 8r377
(Implementation note: Arbitrary-precision unsigned integers are implemented using the GNU Multi_Precision Package. Twos-complement integers are implemented using this package. FixInts are BigNums that fit in one word (usually, 32 bits). The most common FixInts (about -100 to +1000) are pre-allocated.)