To access the calculator, click Tools → Calculator, or use the calculator command.

You can use the calculator in various ways. Type in mathematical expressions from the keyboard or by clicking buttons, including parentheses. Almost all the editing keys including undo, next word, and previous word are supported. The calculator uses a slightly enhanced C expression syntax. The calculator supports specifying binary numbers and allows just an x prefix when specifying hexadecimal numbers.
For example, to add the decimal numbers 135 and 288, type 135+288=. Press the = character to evaluate the expression and place the result on the next line. To see the result in a different base, click Hex, Dec, Oct, or Bin.
To add hex FF with octal 77 with binary 111 with decimal 99, complete the following steps:
Click Hex then type or click FF.
Click +.
Click Octal, and type or click 77.
Click +.
Click Bin, and type or click 111.
Click +.
Click Dec, and type or click 99.
Select the output base by clicking one of the base buttons and type or click =to compute the result.
Evaluate mathematical expressions by selecting expressions in a buffer and executing the add command or by executing one of the math commands on the command line followed by an expression.
These commands support the same expression input. The syntax of the math command is:
math [expression]
The math command evaluates the Slick-CŪ language expression given and places the results in the message line. You can specify octal numbers by prefixing the number with a zero and specify binary numbers by prefixing the number with the character b. If no operator is specified between two unary expressions, addition is assumed. The characters $ and comma (,) are stripped from the expression before it is evaluated. The mathx, matho, and mathb commands evaluate the Slick-C language expression given and places the result in the message line in hexadecimal, octal, and binary respectively. The expression can have the following unary operators:
~ bitwise complement
- negation
+ no change
The available binary operators are listed below, from lowest to highest precedence. A comma after the operator indicates that the next operator is of the same precedence.
|
Operator |
Meaning |
|
&, | |
bitwise AND, bitwise OR |
|
^ | |
|
+, blank(s), - |
addition, implied addition, subtraction |
|
*, /, % |
multiplication, division, remainder |
|
** |
power |
Hexadecimal numbers are prefixed with the characters 0x or just x. Octal numbers are prefixed with the character O or digit 0.
Not all Slick-C language operators are supported.
The following table shows some examples of math commands:
If overflow or underflow occurs, the message Numeric overflow or underflow is displayed on the message line. Floating point numbers may have up to a 32-digit mantissa and a 9-digit exponent.
Type mathematical expressions into a buffer and evaluate them with the add command. This feature is called document math. The add command adds selected text and inserts the result below the last line of the selection. If no operator exists between two adjacent numbers on the same line, addition is assumed. The result of each adjacent line is added.
Prime numbers are often useful for sizing hash tables. The isprime command (used from the command line) takes a decimal number as an argument and tells you if it is prime, and if not, its first divisor. The nextprime command takes a decimal number as an argument and finds the next greater prime number.