Calc normally displays numbers in decimal (*base-10* or *radix-10*)
notation. Calc can actually display in any radix from two (binary) to 36.
When the radix is above 10, the letters `A`

to `Z`

are used as
digits. When entering such a number, letter keys are interpreted as
potential digits rather than terminating numeric entry mode.

The key sequences `d 2`, `d 8`, `d 6`, and `d 0` select
binary, octal, hexadecimal, and decimal as the current display radix,
respectively. Numbers can always be entered in any radix, though the
current radix is used as a default if you press `#` without any initial
digits. A number entered without a `#` is *always* interpreted
as decimal.

To set the radix generally, use `d r` (`calc-radix`

) and enter
an integer from 2 to 36. You can specify the radix as a numeric prefix
argument; otherwise you will be prompted for it.

Integers normally are displayed with however many digits are necessary to
represent the integer and no more. The `d z` (`calc-leading-zeros`

)
command causes integers to be padded out with leading zeros according to the
current binary word size. (See Binary Number Functions, for a discussion of
word size.) If the absolute value of the word size is ‘`w`’, all integers
are displayed with at least enough digits to represent
‘`(2^w)-1`’
in the current radix. (Larger integers will still be displayed in their
entirety.)

Calc can display ‘`w`’-bit integers using two’s complement
notation, although this is most useful with the binary, octal and
hexadecimal display modes. This option is selected by using the
`O` option prefix before setting the display radix, and a negative word
size might be appropriate (see Binary Number Functions). In two’s
complement notation, the integers in the (nearly) symmetric interval
from
‘`-2^(w-1)`’
to
‘`2^(w-1)-1`’
are represented by the integers from ‘`0`’ to ‘`2^w-1`’:
the integers from ‘`0`’ to
‘`2^(w-1)-1`’
are represented by themselves and the integers from
‘`-2^(w-1)`’
to ‘`-1`’ are represented by the integers from
‘`2^(w-1)`’
to ‘`2^w-1`’ (the integer ‘`k`’ is represented by ‘`k+2^w`’).
Calc will display a two’s complement integer by the radix (either
‘`2`’, ‘`8`’ or ‘`16`’), two `#` symbols, and then its
representation (including any leading zeros necessary to include all
‘`w`’ bits). In a two’s complement display mode, numbers that
are not displayed in two’s complement notation (i.e., that aren’t
integers from
‘`-2^(w-1)`’
to
‘`2^(w-1)-1`’)
will be represented using Calc’s usual notation (in the appropriate
radix).