5. Numeric Bases

Numeric bases other than 10 are of interest mainly in mathematics and computing science. A prefix notation is used to express numbers in various numeric bases. Enter a base value from 2 to 36, followed by a single quote, followed by a string of digits in the numeric base you specified. No spaces. Representations of number 156 in numeric bases 2, 8 and 16 are:

2'10011100 = 156

8'234 = 156

16'9C = 156

All calculations can be done on numbers expressed in any numeric base, even different ones. Base 10 is assumed unless a different one is specified:

3'12021 + 25 + 36'Z8 = 1,435

Results are always expressed in decimal (base 10) unless a different base is requested. Requesting output in a numeric base other than 10 is done with a notation that resembles the one just described. To get the result of a calculation in base 4, start the line with a single quote, then the number 4 (the base you want), then at least one separating space before the expression itself:

'4 3*sqrt(10) = 4'21.13303

The result is given in the requested base, including the fractional part. The value of any expression can be output in bases from 2 to 36 using this notation.

To convert numbers from one base to the other, specify the base you want at the start of the line and express the value in the other base. This example converts binary number 10110111 into base 16 (hex), and hex number FA into binary:

'16 2'10110111 = 16'B7

'2 16'FA = 2'11111010

<< Back to the overview.