rca -- a rich/RPN scientific and programmer's calculator
Any arguments on the command line are used as initial calculator input.
Entering a number pushes it on the stack.
Operators replace either one or two stack values with their result.
Most whitespace is optional between numbers and operators.
Input can include locale currency and digit grouping symbols (e.g. $12,345)
Always prefix hex ("0x7f") or octal ("0o177"), even in hex or octal mode.
Infix expressions are entered using (...), as in: (sin(30)^2 + cos(30)^2)
Below, 'x' refers to top-of-stack, 'y' refers to the next value beneath.
rca's normal exit value reflects the logical value of the top of stack.
Numeric operators with two operands:
+, - Add and subtract x and y
*, or x Multiply x and y
/, % Divide and modulo of y by x
^, or ** Raise y to the x'th power
>>, << Shift y right/left by x bits (logical shift)
ror, rol Rotate y right/left by x bits
&, |, xor Bitwise AND, OR, and XOR of y and x
setb, clearb Set and clear bit x in y
Numeric operators with one operand:
~ Bitwise NOT of x (1's complement)
chs, or negate Change sign of x (2's complement)
recip, sqrt Reciprocal and square root of x
sin, cos, tan
asin, acos, atan Trig functions
atan2 Arctan of y/x (2 operands)
exp Raise e to the x'th power
ln, log2, log10 Natural, base 2, and base 10 logarithms
abs, frac, int Absolute value, fractional and integer parts of x
Logical operators (mostly two operands):
&&, || Logical AND and OR
==, !=, <, <=, >, >= Arithmetic comparisons
! Logical NOT of x
Unit conversions (one operand):
i2mm, mm2i inches / millimeters
ft2m, m2ft feet / meters
mi2km, km2mi miles / kilometers
f2c, c2f degrees F/C
oz2g, g2oz US ounces / grams
oz2ml, ml2oz US fluid ounces / milliliters
q2l, l2q US quarts / liters
d2r, r2d degrees / radians
dd2dms, dms2dd decimal degrees / deg.mm.sss
mpg2l100km mpg to l/100km and vice versa
Constants and storage:
sto, rcl Save to or push from off-stack storage
pi, e Push constant pi or e
lastx, or lx Push previous value of x
_<name> Push variable
= Assign variable. RPN: "3 = _v" infix: "(_v = 3)"
variables, or vars Show the current list of variables
clearvariables Discard all variables
Variadics (operate on entire stack, limited by the mark if set):
sum, avg, stddev Total, mean, and standard deviation of entries
snapshot Saves copy of selected entries
mark Mark the stack, to limit variadics' range
Stack manipulation:
clear Clear stack
pop Pop (and discard) x
push, or dup Push (a duplicate of) x
exch, or swap Exchange x and y
restore Push a copy of the snapshot, set mark
clearsnapshot Discard snapshot
Other:
(, ) Infix grouping
; Infix separator (in RPN, discards y)
: Treat rest of line as RPN. (needed in infix mode)
nop Does nothing, but at end of line, suppresses output
Display:
P Print whole stack according to mode
p Print x according to mode
f, d, u Print x as float, decimal, unsigned decimal,
h, o, b hex, octal, or binary
automatic, or auto Select general purpose floating display format
engineering, or eng Select engineering style floating display format
fixed Select fixed decimal floating display format
digits Number of digits for floating formats
Modes:
F, D, H, O, B Switch to floating, decimal, hex, octal, binary mode
width, or bits Set effective word size for integer modes
zerofill, or zf Toggle left-fill with zeros in H, O, and B modes
rightalign, or ra Toggle right alignment of numbers
degrees Toggle trig functions: degrees (1) or radians (0)
autoprint, or ap Toggle autoprinting on/off with 0/1
separators, or sep Toggle numeric separators on/off (0/1)
mode Display current mode parameters
infix Toggle running mainly in infix, or in rpn
Housekeeping:
?, or help Show this list (using $PAGER, if set)
config Show current configuration settings
state Show calculator state
precedence List infix operator precedence
quit, q, or exit Leave the calculator
echo Toggle echoing input when stdin is a file or pipe
errorexit Toggle exiting on error and warning
debug Toggle presence of debug commands
license Display the rca copyright and license.
version Show program version
# Comment. The rest of the line will be ignored.
version v24 Mar 15, 2026
Tip: Use "rca help q | less" to view this help