calc command

Use the calc command to perform simple calculations.


calc expression 


expression The expression you specify may consist of numbers, operators, and functions.  The following operators are supported:
+ plus, unary plus
- minus, unary minus
* multiply
/ divide
** power
% remainder
& bitwise AND
| bitwise OR
^ bitwise exclusive OR
~ unary bitwise complement.
The following functions are supported: 
cos cosine
max maximum
min minimum
random random number
sin sine
sqrt square root
tan tangent.
Hexadecimal numbers can be entered in the formats exemplified here:  0xAba, xff, #Cafe, x'4f'.

The result is displayed on the message line.

If no parameters are specified, the calc command will use the selection in the current document view, if any, as the expression to calculate.


The status parameter is not affected by this command.


calc 1024
calc (298 + 584/4) / 111
calc max(3., -1, 5/2, random()) 

Related concepts
Editor commands, actions, and parameters