Appomatox Calculator Help
Calculate expressions, reuse results, work with measurements, and draw diagrams in your browser or terminal.
Quick start
- Open the calculator in your browser and set Mode to Decimal. If you have the app files on your computer, open
index.html; no terminal setup is needed for browser calculations. - Type
2+3*4at the>prompt, then press Enter or tap =. The result is14. - Type
LAST*2and calculate again. The result is28. - For the decimal examples in this guide, enter
:locale usand:mode dec. Now tryROUND(1/3;2); the result is0.33.
Enter one expression or command at a time. The history shows your input followed by its result. Use typical tasks to try more, or jump to the function index to look up a name.
Contents
Using the calculator
Browser and mobile controls
The illustration shows the controls in reading order; their spacing changes with the screen size.
| Control | What it does |
|---|---|
| Mode, below the app title | Choose Decimal, Hex, or Binary output |
| Angle, next to Mode | Choose RAD (radians) or DEG (degrees) |
| History area | Read previous inputs and results; scroll to older calculations |
Input next to > | Type an expression or a : command and press Enter |
| Keyboard, above the operator buttons | On mobile, choose Numeric for numbers or Alphanumeric for functions, variables, and commands |
| = | Calculate the current input |
| C / ⌫ | Clear the current input / delete the selection or character before the cursor |
| :help, in the footer | Open this guide |
On a phone, tap the input to open the screen keyboard. Switch Keyboard to Alphanumeric when you need letters, semicolons, or square brackets. The operator buttons provide parentheses and common arithmetic symbols.
Reusing history
Start with an empty input to browse history; after recalling an entry, keep using the arrow keys to browse further.
- ArrowUp / ArrowDown recall earlier or later inputs.
- Shift+ArrowUp / Shift+ArrowDown recall results instead.
LASTor_uses the previous successful result in a new calculation.:historylists previous calculations;:clearclears the history.
When a suggestion list is open, the arrow keys navigate that list instead of the history.
Completing names
Type at least two letters of a function name, or start a command with :. Press Tab to complete the selected name. For functions with arguments, the cursor moves inside the parentheses.
In the browser, ArrowUp / ArrowDown select a suggestion, Enter accepts it after you have navigated the list, and Escape closes it. The interactive terminal also supports Tab completion.
Using editors
Use :edit LIST, :edit SET, :edit SERIES, :edit TIME, :edit TRIANGLE, or :edit CIRLE to open a form. You can also edit an existing value or variable, for example :edit SERIES([1;2;3]) or :edit VALUES.
In a field-based editor, use Tab / Shift+Tab or the arrow keys to move between fields, Enter to calculate, and Escape to cancel. The browser also has Calculate and Cancel buttons. In collection editors, enter one value per line.
Commands at a glance
These commands work in the browser and interactive terminal:
| Command | Purpose |
|---|---|
:help | List available functions and commands |
:vars | List stored variables |
:clear, :history | Clear or show history |
:edit TYPE | Open an editor |
:draw X^2 | Draw a function; see diagrams |
:chart auto, :chart clear | Fit the diagram to its data or clear it |
:angle deg, :angle rad | Set the angle unit |
:locale auto, :locale us, :locale de | Set number separators |
:mode dec, :mode hex, :mode bin | Set the result format |
:version | Show the app version |
File execution, saving, history export, terminal diagram rendering, and quitting are covered under terminal use.
Input and number formats
Enter an expression such as 2+3*4, a function call such as SQRT(9), or a command such as :clear. Functions calculate values and can be used inside expressions. Commands start with : and control the calculator, open editors, or draw diagrams.
Operators and brackets
| Symbol | Meaning | Input | Result |
|---|---|---|---|
+, - | Add, subtract | 7-2 | 5 |
*, / | Multiply, divide | 6/2 | 3 |
% | Remainder after division | 5%2 | 1 |
^ | Raise to a power | 2^3 | 8 |
(…) | Calculate this part first | (2+3)*4 | 20 |
Powers are calculated before multiplication, division, and remainder; these are calculated before addition and subtraction. Repeated powers are evaluated from left to right: 2^3^2 means (2^3)^2 and gives 64. Use 2^(3^2) if you want 512. % is a remainder operator; to calculate 20 percent of 80, enter 80*20/100.
Functions, lists, and text
- Separate function arguments with a semicolon:
ROUND(1/3;2). - Function and variable names are case-insensitive:
sqrt(9)works likeSQRT(9). - Put lists in square brackets and separate values with semicolons:
[1;2;3]. - Put text in single quotes:
ROMAN('XIV'). In text, use\'for a single quote and\nfor a new line. - Store a value with
NAME := value. Use=for named geometry fields, such asCIRLE(RADIUS=3). - Spaces are allowed. A
#outside text starts a comment:2+3 # total.
Decimal and thousands separators
The calculator starts with your system's number format. Use :locale us, :locale de, or :locale auto in the browser or terminal to change it. The browser displays the active number format next to Mode and Angle.
| Setting | Decimal number | Grouped number (one thousand two hundred thirty-four) |
|---|---|---|
:locale us | 1.5 | 1,234 |
:locale de | 1,5 | 1.234 |
:locale auto | Follows your system | Follows your system |
Examples in this guide use :locale us and decimal output (:mode dec) unless another setting is stated. Each arrow reads input -> result; enter only the expression on the left. When an example has several steps, enter them in the given order. Use :locale auto afterwards to restore your system's number format.
Binary and hexadecimal input
Use the prefix 0b for binary numbers and 0x for hexadecimal numbers. Uppercase prefixes work too.
0b10 + 0b01->30xA + 0x2->12
Output and angle modes
Choose Decimal, Hex, or Binary with the browser's Mode selector, or use :mode dec, :mode hex, or :mode bin. Hex and binary numbers have a 0x or 0b prefix; the terminal prompt changes to 0x> or 0b>.
Choose DEG for degrees or RAD for radians with the browser's Angle selector, or use :angle deg or :angle rad. RAD is the initial default. For example, SIN(90) gives 1 in DEG mode; in RAD mode, enter SIN(PI/2).
Typical tasks
The examples below assume :locale us and :mode dec. Execute one line at a time. You can use the same expressions in the browser and interactive terminal.
Store a value and reuse it
Calculate a total for three items at a stored unit price:
PRICE := 12.5
PRICE*3
LAST+5
The subtotal is 37.5; adding 5 gives 42.5. PRICE stays 12.5. If PRICE already exists, confirm its replacement when asked. See variables for removing values.
Average and plot measurements
VALUES := [10;12;14]
STAT_AVG(VALUES)
:draw SERIES(VALUES)
The average is 12. The diagram connects the measurements at (1;10), (2;12), and (3;14). Use :chart auto if an earlier diagram range hides them. For longer lists, enter :edit SERIES and paste one measurement per line.
Calculate a triangle in the editor
- Enter
:angle degso angles are in degrees. - Enter
:edit TRIANGLE. - Fill in
A = 3,B = 4, andGAMMA = 90. Leave the remaining fields empty. - Press Enter or choose Calculate. The missing side
Cis5. - Enter
TRIANGLE(GAMMA=90; A=3; B=4).AREAto calculate its area; the result is6.
You can also enter TRIANGLE(GAMMA=90; A=3; B=4).C directly; the result is 5. See geometry for field names and the diagram.
Draw and adjust a function
:draw X^2
:chart bounds [-3;0];[3;9]
The diagram shows the parabola with X between -3 and 3. Each draw command adds an element to the current diagram. Use :chart clear before starting a new diagram; :chart auto removes fixed bounds.
Add durations and convert to minutes
TIME(1;30;0)+TIME_MIN(45)
TO_MIN(LAST)
The duration is TIME(2;15;0) (2 hours, 15 minutes), then 135 minutes. See time and date for durations, dates, and other units.
Variables and previous results
Variables are case-insensitive and can be used directly in expressions.
- Assign a variable:
NAME := value - Remove a variable:
NAME := ()
When replacing or removing an existing variable, the browser and interactive terminal ask for confirmation first.
- List all variables:
:vars
Examples:
X := 4Y := _X+Y->8
Predefined Read-only Variables
These variables are built in and cannot be overwritten:
PI->3.14159265...KB->1024MB->1024 * 1024GB->1024 * 1024 * 1024TB->1024 * 1024 * 1024 * 1024
Examples:
3MB->31457284KB->4096
Implicit multiplication with variables is supported, for example:
3MB(2+1)MBX(1+2)
LAST
LAST contains the previous successful calculation result. _ is a read-only alias for LAST.
Example:
2+3->5LAST+1->6_+1->7
Persistence
Your saved variables, calculation history, and number/angle settings are kept for the next session when storage is available.
| Where you calculate | Where your data is kept |
|---|---|
| Browser | In that browser profile's local storage for the app location |
| Interactive terminal | In .appomatox-variables.json, .appomatox-history.json, and .appomatox-settings.json in your home folder |
Browser and terminal data are separate; values are not synchronized between devices or browsers. Clearing the browser's site data removes its saved values. Private browsing or blocked storage may prevent them from being kept. Keep important expressions in a separate file.
Use :clear to clear calculation history, NAME := () to remove an individual variable, and :chart clear to clear the current diagram.
Lists, sets, and measurement series
Choose the value type that matches your task:
| Type | Use it for | Duplicates | Example |
|---|---|---|---|
| LIST | Keeping values in their original order | Kept | [1;2;2] |
| SET | Comparing groups of numbers or text | Removed | SET([1;2;2]) |
| SERIES | Plotting numeric measurements in their original order | Kept | SERIES([1;2;2]) |
LIST and SERIES preserve the order of their values, including duplicates. In a SERIES, each position identifies a measurement: when plotted, the first measurement has X coordinate 1, the second 2, and so on. A LIST may also contain text or nested lists; a SERIES requires a non-empty sequence of numbers.
A SET keeps each value only once and displays values in the order of their first occurrence: SET([3; 1; 3]) -> SET([3; 1]). Set operations compare whether values are present, regardless of their positions; two sets can therefore contain the same values in different display orders.
LIST
Creates a list value. Square brackets are mandatory and elements are separated by semicolons. Lists may be empty or nested, and elements may be expressions.
[value; ...][][[x;y]; [x;y]]
Examples:
[1;2;3;4;5.6;7/8](or[1;2;3;4;5,6;7/8]with German locale)[1+2;SQRT(4);FRAC(3;4)][[1;1];[2;2]]
Use STAT_SUM to add the numbers in a list. With two collections, + combines their values into a set and - returns their difference; see the set operations below.
SET and SERIES
Use :draw to plot a SERIES, or pass it to STAT_*, MIN, and MAX to calculate with its measurements.
SERIES([-75; -60; -73])VALUES := [-75; -60; -73], thenSTAT_AVG(VALUES)and:draw SERIES(VALUES)COLORS := SET(['red'; 'blue'; 'red'])->SET(['red'; 'blue'])
Convert a sequence with LIST(sequence), SET(sequence), or SERIES(sequence); the SERIES conversion requires a non-empty sequence containing only numeric values.
CONTAINS
CONTAINS(container; part) returns 1 if the first container contains the second, and 0 otherwise. Each argument can be a LIST, SET, or SERIES; the first argument determines how values are compared.
For a LIST or SERIES, the second container must occur as a contiguous sequence in the same order, including repeated values. For a SET, every value in the second container must occur in the SET; order and repetitions do not matter. An empty second container is always contained.
CONTAINS([1; 2; 2; 3]; [2; 2])->1CONTAINS([1; 2; 3]; [1; 3])->0(the values are not adjacent)CONTAINS(SERIES([1; 2; 3]); [3; 2])->0CONTAINS(SET([1; 2; 3]); [3; 1; 1])->1
Set operations
Each operation takes exactly two arguments, separated by a semicolon. Each argument can be a LIST, SET, or SERIES containing numbers or strings; nested lists are not accepted. The result is always a SET, so duplicate values appear only once.
UNION(left; right)returns all values that occur in either collection (or both). For example,UNION([1; 2; 2]; [2; 3])->SET([1; 2; 3]).INTERSECT(left; right)returns only values that occur in both collections. For example,INTERSECT([1; 2; 2]; [2; 3])->SET([2]).DIFF(left; right)returns values from the first collection that do not occur in the second. The order of the arguments matters:DIFF([1; 2]; [2; 3])->SET([1]), whileDIFF([2; 3]; [1; 2])->SET([3]).SYMDIFF(left; right)returns values that occur in exactly one of the collections, excluding values shared by both. For example,SYMDIFF([1; 2]; [2; 3])->SET([1; 3]).
The result retains the order of the contributing values: INTERSECT and DIFF follow the left argument; UNION takes the left values first, then values found only on the right; SYMDIFF takes values found only on the left first, then values found only on the right. For example, UNION([3; 1]; [2; 3]) -> SET([3; 1; 2]). Swapping arguments can change the display order even when the result contains the same values.
For a short form, A + B is UNION(A; B) and A - B is DIFF(A; B) when both operands are LIST, SET, or SERIES values. Numeric addition and subtraction remain unchanged.
Use :edit LIST, :edit SET, or :edit SERIES to paste or edit one value per line. LIST keeps duplicate rows, SET removes duplicate values, and SERIES validates numeric measurements. In the terminal, a multiline paste is collected before the editor calculates. :edit SERIES([-75; -60; -73]) or :edit COLORS opens the existing values in the appropriate editor.
Formulas
FORMULA and EVAL
Creates, stores, and evaluates a mathematical formula with one named parameter.
FORMULA('parameter'; 'expression')EVAL(formula; value)EVAL(formula)uses the stored variable whose name matches the formula parameterEVAL_LIST(formula; [values])creates a two-dimensional list of[x;y]points
Examples:
F1 := FORMULA('X'; 'X^2+1')EVAL(F1; 3)->10X := 3followed byEVAL(F1)->102*EVAL(F1; 4)+1->35EVAL_LIST(F1; [-2;-1;0;1;2])->[[-2;5];[-1;2];[0;1];[1;2];[2;5]]:draw POINT(EVAL_LIST(F1; [-2;-1;0;1;2]))adds the evaluated points to the diagram
Formula expressions may use their parameter, built-in constants such as PI, and mathematical functions such as SQRT, ROUND, FRAC, and GCD. They cannot change variables or diagrams. Use EVAL to obtain a numeric value before applying arithmetic to a formula.
FILTER, TRIMLEFT, and TRIMRIGHT
FILTER(series; formula) transforms every measurement using a formula; it keeps the number of measurements. TRIM_LEFT(series; n) and TRIM_RIGHT(series; n) remove n measurements from the start or end.
- After
F1 := FORMULA('X'; 'X^2+1'):FILTER(SERIES([1;2;3]); F1)->SERIES([2;5;10]) TRIM_LEFT(SERIES([-75;-60;-73]); 1)->SERIES([-60; -73])TRIM_RIGHT(SERIES([-75;-60;-73]); 1)->SERIES([-75; -60])
Geometry
Enter the sides, angles, or circle measurements you know. The calculator finds the missing values. Use :edit TRIANGLE or :edit CIRLE for a form, or enter the named fields directly.
TRIANGLE
Start with the side lengths A, B, and C, or with A, B, and the angle GAMMA opposite side C. Use the same unit for every side length. Calculated lengths use that unit and areas use its square.
| Field | Meaning |
|---|---|
A, B, C | Side lengths |
ALPHA, BETA, GAMMA | Angles opposite A, B, and C |
AREA | Triangle area |
PERIMETER | Total length of all three sides |
Angles use the active DEG or RAD mode. The examples below use DEG unless RAD is stated explicitly; enter :angle deg first. Read a single calculated field with a dot, for example TRIANGLE(A=3; B=4; C=5).AREA.
- with
:angle deg:TRIANGLE(GAMMA=90; A=3; B=4).C->5 - with
:angle rad:TRIANGLE(GAMMA=PI/2; A=3; B=4).GAMMA-> approximately1.5707963267948966 TRIANGLE(A=3; B=4; C=5).GAMMA->90TRIANGLE(A=3; B=4; C=5).CX->3.2
Without a field after the dot, the result lists all known and calculated fields.
The model calculates C from GAMMA, A, and B, calculates GAMMA from all three sides, and also uses GAMMA, C, and one other side when that has one unambiguous solution. Values that violate the triangle inequality or contradict each other produce an error. Inputs with two possible triangles ask for another independent field rather than silently selecting one. With too few independent values, known fields are shown and unknown fields are displayed as ?.
Additional fields and aliases:
| Fields | Meaning | Example alias |
|---|---|---|
HA, HB, HC | Heights to each side | HEIGHT_A |
MA, MB, MC | Medians to each side | MEDIAN_A |
WA, WB, WC | Angle bisectors | BISECTOR_A |
SEMIPERIMETER | Half the perimeter | — |
INRADIUS, CIRCUMRADIUS | Inscribed and circumscribed circle radii | — |
P, Q | Sections of side C shown in the diagram | — |
AX, AY, BX, BY, CX, CY | Vertex coordinates | — |
SIDE_A and ANGLE_GAMMA are accepted as descriptive aliases for A and GAMMA.
Use :edit TRIANGLE to open an empty triangle editor, or :edit TRIANGLE(A=3; B=4) to continue an existing triangle in the editor. The editor creates the same TRIANGLE(...) expression; it does not retain a partially entered triangle. TRIANGLE without fields is an error and points to :edit TRIANGLE.
AX, AY, BX, BY, CX, and CY are the vertex coordinates. AX and AY default to 0. For a complete triangle, B and C are derived using a horizontal base from A to B and C above that base. :draw TRIANGLE(...) adds its three vertices to the diagram. Use the arrow keys to move between fields, Tab / Shift+Tab to move forward / back, Enter to calculate, and Escape to cancel. In the browser, the focus follows the visible field grid; the terminal editor shows every field in a two-column form.
CIRLE
The circle function is spelled CIRLE. Use that spelling when typing it.
CIRLE(RADIUS=...) represents a circle. Enter any one positive value for RADIUS, DIAMETER, CIRCUMFERENCE, or AREA; the other three values are calculated consistently. Short aliases R, D, U, and A are accepted.
CIRLE(RADIUS=3).DIAMETER->6CIRLE(DIAMETER=10).CIRCUMFERENCE->31.41592653589793CIRLE(AREA=PI*9).RADIUS->3
Use :edit CIRLE to open the circle editor, or :edit CIRLE(AREA=PI*9) to continue with an existing value. The editor uses the same named-field syntax. CIRLE without a field points to :edit CIRLE.
Diagrams
Drawing and adjusting a diagram
:draw draws two-dimensional POINT values, connected SERIES measurements, TRIANGLE vertices, and continuous FORMULA curves in the browser or terminal.
:draw POINT(x; y)or:draw POINT([x; y]; [x; y]; ...):draw SERIES([value; ...])connects numbered measurement points and shows the markers:draw FORMULA(...)draws a connected curve without point markers:draw TRIANGLE(...)draws the three triangle vertices:chart output textuses the built-in terminal diagram renderer;:chart output chafawrites a temporary SVG and renders it with Chafa. Switching tochafafails when Chafa is unavailable.:draw X^2creates a formula from an inline expression usingX- coordinates may contain arithmetic expressions
- POINT x-coordinates may also be DATE values or TIME values containing a date; y-coordinates remain numeric
- consecutive drawing calls add a new, differently colored series to the existing diagram
- the color palette repeats after all available colors have been used
:chart bounds [minX; minY]; [maxX; maxY]sets a fixed visible area:chart autoremoves fixed bounds and fits the current data:chart scale equalkeeps one X unit and one Y unit equally long (default):chart scale stretchstretches the bounds exactly to the available diagram area:chart connect onconnects POINT values within each element in input order, keeping the markers visible;:chart connect offrestores separate markers (default). This also updates existing diagram elements.:chart seriesmarkers ondraws a circle at everySERIESmeasurement (default):chart seriesmarkers offdrawsSERIESvalues as continuous lines only:chart clearremoves all series, bounds, and resets the color sequence:chart editlists the numbered chart elements and their colors:chart remove 2removes element 2; remaining element numbers remain stable:chart color 3 redchanges element 3 toblue,red,green,orange,purple,pink,slate, oryellow:chart editboundsopens an editor for the four bounds
For a time series with explicit dates, enter these two lines:
POINT([DATE(2026;10;10);1500]; [DATE(2026;10;11);1800]; [DATE(2026;10;12);1400])
:draw _
The x-axis displays calendar dates and preserves elapsed time between measurements. Dated TIME values work too, for example POINT([TIME(2026;10;12;8;0;0);10]; [TIME(2026;10;12;12;0;0);20]). Short ranges show the date and time. Dates use the local time zone, as with TIME1970; daylight-saving changes affect elapsed spacing. Time charts always scale the axes independently. When zero is outside the visible range, thinner axes are drawn along the left and bottom edges (dotted in terminal text); these edges represent the visible bounds, not zero. POINT displays separate markers by default; use :chart connect on to connect them. Numeric and date x-coordinates cannot be mixed within a POINT value or diagram; use :chart clear before switching axis types. Formatting a DATE value returns the equivalent TIME expression.
Examples:
:draw POINT([0;0];[1;1];[2;4]):draw POINT(PI;SQRT(2))adds another series:draw SERIES([-75; -60; -73; -50]):draw F1adds a continuous curve for the stored formula:draw X^2draws a curve from an inline expression:chart bounds [1; -80]; [17; -30]fixes a data-focused range and redraws an existing diagram:chart autoreturns to automatic scaling:chart scale stretchfills the diagram area exactly with the selected bounds:chart seriesmarkers offhides the individual measurement circles:chart clearclears the diagram:chart edit, then:chart color 2 purplechanges one element without redrawing the others
Chart bounds remain active for subsequent drawing calls. They may exclude the origin, which is useful for measurement series; an axis is shown only when zero lies within the visible area. Points and curve sections outside the visible range are hidden. equal may expand one axis to preserve equal units; stretch keeps the requested bounds exact and scales the axes independently.
In the browser, pasting three or more newline-separated numeric values into an empty input creates SERIES([...]).
Formula curves appear as connected lines. Gaps are left where the function has no defined value. Without fixed bounds, formulas are drawn from X = -10 to X = 10; changing the bounds redraws them across the new visible range.
POINT
POINT creates a finite two-dimensional point value for the drawing editor. It accepts either one coordinate pair or several bracketed pairs:
POINT(1; 2)POINT([0; 0]; [1; 1]; [2; 4])POINT([[0; 0]; [1; 1]])
Function reference
Look up a function below by topic, or use the alphabetical function index. Arguments are separated by semicolons (;).
Syntax: FUNCTION_NAME(arg1; arg2; ...)
Basic mathematics
MIN and MAX
Return the smallest or largest value. Each function accepts either two numeric arguments or one non-empty numeric list, set, or measurement series.
MIN(5;3)->3MAX(5;3)->5MIN([3;-2;5;1])->-2MAX([3;-2;5;1])->5MIN([FRAC(1;2);FRAC(1;3);FRAC(3;4)])->FRAC(1;3)MAX([FRAC(1;2);FRAC(1;3);FRAC(3;4)])->FRAC(3;4)
MIN([]) and MAX([]) are undefined and produce an error. The two-argument form can also be used inside FORMULA expressions.
ROUND
Rounds a value to the given number of decimal places.
ROUND(value)— rounds to integer (0 decimal places)ROUND(value; digits)— rounds todigitsdecimal places
Examples:
ROUND(1/3; 2)->0.33ROUND(1.5)->2ROUND(2/3; 2)->0.67
SQRT
Returns the square root of a value.
SQRT(value)
Examples:
SQRT(4)->2SQRT(1+8)->3SQRT(2)^2->2
SUM and PRODUCT
Evaluate an expression or a FORMULA value for every integer in an inclusive range.
SUM(expression or FORMULA; start; end)adds the resulting termsPRODUCT(expression or FORMULA; start; end)multiplies the resulting termsstartandendmust be integers- up to 100,000 terms are supported
Examples:
SUM(X;1;5)->15SUM(X^2;1;5)->55SUM(FORMULA('N'; 'N^2');1;5)->55PRODUCT(X;1;5)->120PRODUCT(X+1;1;3)->24SUM(FRAC(1;X);1;3)->FRAC(11;6)
X is local to the function and does not overwrite a stored variable with the same name. An expression is entered directly and usually uses X, such as X^2. A FORMULA is a value created beforehand with FORMULA('N'; 'N^2'); its declared parameter is substituted for each term. An empty range returns 0 for SUM and 1 for PRODUCT.
Number format conversions
ROMAN
Converts an integer from 1 through 3999 to conventional Roman numerals, or a Roman numeral back to an integer. Roman numeral input must use conventional subtractive notation.
ROMAN(value)
Examples:
ROMAN(1978)->MCMLXXVIIIROMAN('MCMLXXVIII')->1978
TOHEX
Converts an integer value to hexadecimal text.
TOHEX(value)
Examples:
TOHEX(12)->0xCTOHEX(0xA + 0x2)->0xC
TOBIN
Converts an integer value to binary text.
TOBIN(value)
Examples:
TOBIN(12)->0b1100
TODEC
Converts a fraction value to decimal output.
TODEC(value)
Examples:
TODEC(FRAC(1;4))->0.25TODEC(0.25)->0.25
Integers and number theory
GCD
Returns the greatest common divisor of two integer values.
GCD(value1; value2)
Examples:
GCD(6;9)->3GCD(11;4)->1
EVEN and ODD
Test whether an integer is even or odd. Both functions return either 0 or 1.
EVEN(integerValue)returns1for an even integer and0otherwiseODD(integerValue)returns1for an odd integer and0otherwise
Examples:
EVEN(4)->1EVEN(3)->0ODD(4)->0ODD(3)->1
LCM
Calculates the non-negative least common multiple of two integers.
LCM(a; b)LCM(12;18)->36LCM(-12;18)->36LCM(0;18)->0
FACTORS
Returns the prime factorization of an integer as a list. Repeated prime factors remain repeated, and negative values start with -1.
FACTORS(12)->[2; 2; 3]FACTORS(360)->[2; 2; 2; 3; 3; 5]FACTORS(-12)->[-1; 2; 2; 3]FACTORS(1)->[]
Prime factorization is not defined for zero, so FACTORS(0) returns an error.
FACTORIAL
Returns the factorial of a non-negative integer value.
FACTORIAL(value)
Examples:
FACTORIAL(0)->1FACTORIAL(10)->3628800FACTORIAL(1000)-> the exact 2568-digit integer
Random values and identifiers
GUID
Returns a new GUID/UUID string.
GUID()
Example:
GUID()->xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
RANDOM
Returns a random integer between 0 and the given positive maximum, inclusive.
RANDOM(max)
Example:
RANDOM(10)-> an integer from0to10
RANDOM_PWD
Returns a random string with 40 characters. Results from expressions calling RANDOM_PWD() are displayed but are not added to the calculation history or its saved copy. The string can contain lowercase letters, uppercase letters, numbers, and these symbols:
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ { | } ~ `
RANDOM_PWD()
Example:
RANDOM_PWD()-> a 40-character random password
Text, encoding, and files
GEO
Converts a WGS-84 coordinate into decimal degrees (DD), degrees/minutes/seconds (DMS), degrees and decimal minutes (DDM), UTM, and MGRS. The output also contains a Google Maps link.
GEO('coordinate')
Examples:
GEO('52.5200, 13.4050')GEO('52°31'12.0"N 13°24'18.0"E')GEO('52°31.200'N 13°24.300'E')GEO('33U 391779 5820072')GEO('33U UU 91779 20072')
BASE64
Converts a string value to base64 text. Single quotes inside the string can be escaped with \', and \n inserts a newline.
BASE64('text')
Examples:
BASE64('hello')->aGVsbG8=BASE64('it\'s')->aXQncw==BASE64('hello\nworld')->aGVsbG8Kd29ybGQ=
DEBASE64
Decodes base64 text back to a string value.
DEBASE64('text')
Examples:
DEBASE64('aGVsbG8=')->helloDEBASE64('aXQncw==')->it'sDEBASE64('aGVsbG8Kd29ybGQ=')->hello+ newline +world
Statistics
STAT_SUM
Calculates the sum of a one-dimensional numeric LIST, SET, or SERIES.
STAT_SUM([value; ...]),STAT_SUM(SET([value; ...])), orSTAT_SUM(SERIES([value; ...]))
Examples:
STAT_SUM([1;4;2;5])->12STAT_SUM([1+2;SQRT(4);7/8])->FRAC(47;8)STAT_SUM([])->0
STAT_AVG
Calculates the average of a one-dimensional numeric LIST, SET, or SERIES.
STAT_AVG([value; ...]),STAT_AVG(SET([value; ...])), orSTAT_AVG(SERIES([value; ...]))
Examples:
STAT_AVG([1;4;2;5])->3STAT_AVG([])->0
STAT_MEDIAN
Calculates the median of a one-dimensional numeric LIST, SET, or SERIES.
STAT_MEDIAN([value; ...]),STAT_MEDIAN(SET([value; ...])), orSTAT_MEDIAN(SERIES([value; ...]))
Examples:
STAT_MEDIAN([1;4;2;5;3])->3STAT_MEDIAN([1;2;5;9])->3.5STAT_MEDIAN([])->0
Additional statistical functions
All functions except STAT_COUNT accept a one-dimensional numeric LIST, SET, or SERIES. STAT_COUNT counts the top-level values in a LIST, SET, or SERIES without requiring numeric values.
STAT_PERCENTILE([value; ...]; percentile)calculates a percentile from0to100using Type-7 linear interpolationSTAT_COUNT([value; ...])counts the values; an empty sequence returns0STAT_STDDEV([value; ...])calculates the sample standard deviation usingn - 1STAT_STDERR([value; ...])calculates the standard error asSTAT_STDDEV(values) / SQRT(n)STAT_VARIANCE([value; ...])calculates the sample variance usingn - 1STAT_RANGE([value; ...])calculates maximum minus minimum
STAT_SUM([value; ...]) continues to calculate the sum as described above.
Examples:
STAT_PERCENTILE([0;10;20;30;40];90)->36STAT_COUNT([2;4;4;4;5;5;7;9])->8STAT_SUM([2;4;4;4;5;5;7;9])->40STAT_VARIANCE([2;4;4;4;5;5;7;9])-> approximately4.571428571428571STAT_STDDEV([2;4;4;4;5;5;7;9])-> approximately2.138089935299395STAT_STDERR([2;4;4;4;5;5;7;9])-> approximately0.7559289460184544STAT_RANGE([2;4;4;4;5;5;7;9])->7
STAT_VARIANCE, STAT_STDDEV, and STAT_STDERR require at least two values. STAT_PERCENTILE and STAT_RANGE require a non-empty list.
Bitwise operations
LSHIFT
Shifts an integer value to the left.
LSHIFT(value; bits)
Example:
LSHIFT(1;3)->8
RSHIFT
Shifts an integer value to the right.
RSHIFT(value; bits)
Example:
RSHIFT(8;2)->2
XOR
Applies bitwise XOR to two integer values.
XOR(value1; value2)
Example:
XOR(3;1)->2
OR
Applies bitwise OR to two integer values.
OR(value1; value2)
Example:
OR(1;2)->3
AND
Applies bitwise AND to two integer values.
AND(value1; value2)
Example:
AND(1;2)->0
Exact fractions
FRAC
Creates an exact fraction value. Calculations with fractions and integers keep an exact fraction result.
FRAC(numerator; denominator)- both parameters must be integers
Examples:
FRAC(1;3) / 2->FRAC(1;6)FRAC(1;3) * 2->FRAC(2;3)FRAC(1;3) * 3->1FRAC(1;2) + FRAC(1;4)->FRAC(3;4)
Combining a fraction with a decimal number produces a decimal result, which may be rounded.
Examples:
FRAC(1;2) + 0.25->0.75TODEC(FRAC(1;4))->0.25
Powers, logarithms, and general mathematics
ROOT(value; base)calculatesvalue^(1/base);valuemust be greater than zero andbasemay be any non-zero positive or negative number, including a fractionLOG10(value)calculates the base-10 logarithmLOG2(value)calculates the base-2 logarithmLOG(value; base)calculates a logarithm with an arbitrary positive base other than oneEXP(value)calculatese^valueLN(value)calculates the natural logarithmSIGNUM(value)returns-1,0, or1ABS(value)calculates the absolute value
Logarithm values must be greater than zero. These functions can also be used inside FORMULA expressions.
Examples:
ROOT(16;2)->4ROOT(8;FRAC(1;3))->512ROOT(16;-2)->0.25ROOT(16;FRAC(-1;2))->0.00390625LOG10(1000)->3LOG2(8)->3LOG(81;3)->4EXP(0)->1LN(EXP(2))->2SIGNUM(-12.5)->-1SIGNUM(0)->0ABS(-12.5)->12.5EVAL(FORMULA('X'; 'ROOT(X;2)+LOG2(X)');4)->4
Trigonometry, hyperbolic functions, and angle conversion
The circular trigonometric functions use the active angle mode. RAD is the default.
SIN(value),COS(value), andTAN(value)interpret their argument using the active modeASIN(value),ACOS(value), andATAN(value)return an angle using the active mode- CLI: use
:angle rador:angle deg - Browser: use the
Angleselector
Examples:
:angle deg, thenSIN(90)->1:angle deg, thenATAN(1)->45:angle rad, thenSIN(PI/2)->1:angle rad, thenATAN(1)-> approximately0.7853981633974483
The hyperbolic functions are independent of the angle mode:
SINH(value),COSH(value),TANH(value)ASINH(value),ACOSH(value),ATANH(value)
Explicit conversion functions also work independently of the active mode:
TO_RAD(180)->PIas a decimal valueTO_DEG(PI)->180
Time and date
TIME
Creates a duration with three parts (hours, minutes, seconds), or a local date and time with six parts (year, month, day, hours, minutes, seconds).
TIME(hours; minutes; seconds)TIME(year; month; day; hours; minutes; seconds)DATE(year; month; day)creates the same TIME value with hours, minutes, and seconds set to zero. Invalid calendar dates are rejected.- all parameters must be integers
Use :edit TIME to enter all date, clock, millisecond, microsecond, and nanosecond parts in one form. :edit TIME(...), :edit TIME_MS(...), :edit TIME_MICROS(...), and :edit TIME_NS(...) prefill the matching fields. Year, month, and day must be entered together; precision fields are added to the TIME value. :edit TIMENOW() starts with the current local date and time. :edit LAST and :edit _ reopen the most recent TIME value.
Examples:
TIME(1;2;3) + TIME(5;3;2)->TIME(6;5;5)TIME(5;3;2) - TIME(1;2;3)->TIME(4;0;59)TIME(1;2;3) * 2->TIME(2;4;6)TIME(0;2;7) * 2.5->TIME_MS(317500)TIME(0;2;8) / 2->TIME(0;1;4)TIME(5;0;0) / TIME(0;3;0)->100
TIMENOW
Returns the current local date and time as a TIME value.
TIMENOW()
Example:
TIMENOW()-> for exampleTIME(2026;3;30; 14;30;5); your result uses the current local date and time
TIME_WEEKDAY
Returns the weekday of a dated TIME value using its complete localized name. The active :locale setting controls the language: de uses German names, us uses English names, and auto follows the runtime locale.
TIME_WEEKDAY(TIME(2026;7;23;19;18;0))->Donnerstagwith:locale deTIME_WEEKDAY(TIME(2026;7;23;19;18;0))->Thursdaywith:locale us
TIME_WEEKDAY requires a TIME value containing year, month, and day. A three-parameter TIME(hours; minutes; seconds) is a duration and has no weekday.
TIME_MS
Creates a TIME value from milliseconds.
TIME_MS(ms)msmust be an integer
Examples:
TIME_MS(3723004)->TIME_MS(3723004)TIME_MS(-1234)->TIME_MS(-1234)
TIME_NS
Creates a TIME value from nanoseconds.
TIME_NS(ns)nsmust be an integer
Examples:
TIME_NS(1234567890)->TIME_NS(1234567890)TIME_NS(-1234567890)->-TIME_NS(1234567890)TIME_NS(1234000000)->TIME_MS(1234)
TIME_MICROS
Creates a TIME value from microseconds.
TIME_MICROS(micros)microsmust be an integer
Examples:
TIME_MICROS(1234567)->TIME_MICROS(1234567)TIME_MICROS(-1234567)->-TIME_MICROS(1234567)TIME_MICROS(1234000)->TIME_MS(1234)
TO_DAY, TO_HOUR, TO_MIN, TO_SEC, TO_MS, TO_MICROS, TO_NS
Convert a TIME value to a numeric total in the named unit.
TO_DAY(TIME(...))TO_HOUR(TIME(...))TO_MIN(TIME(...))TO_SEC(TIME(...))TO_MS(TIME(...))TO_MICROS(TIME(...))TO_NS(TIME(...))
Examples:
TO_SEC(TIME(1;30;0))->5400TO_HOUR(TIME(1;30;0))->1.5TO_MICROS(TIME_NS(1234567))->1234.567
For a TIME value containing a date, the result is the corresponding local Unix time in the selected unit, consistent with TO_TIME1970 and TO_DURATION.
TIME_SEC, TIME_MIN, TIME_HOUR, TIME_DAY
Create TIME values from integer seconds, minutes, hours, or days. The resulting values support the same arithmetic operations as other TIME values.
TIME_SEC(secs)TIME_MIN(mins)TIME_HOUR(hours)TIME_DAY(days)
Examples:
TIME(1;2;3) + TIME_MIN(2)->TIME(1;4;3)TIME(1;2;3) - TIME_SEC(4)->TIME(1;1;59)TIME_DAY(2)->TIME(48;0;0)
TIME1970
Converts a unix epoch value to TIME(...). Input can be in seconds, milliseconds, microseconds, or nanoseconds.
TIME1970(epoch)epochmust be an integer
Examples:
TIME1970(1711805010)-> localTIME(...)valueTIME1970(1711805010000)-> same localTIME(...)valueTIME1970(1711805010000000)-> same localTIME(...)value
TO_TIME1970
Converts a TIME(...) value (with date fields) to unix epoch milliseconds.
TO_TIME1970(TIME(...))
Examples:
TO_TIME1970(TIME(2026;3;30;13;23;30))-> epoch millisecondsTO_TIME1970(TIME1970(1711805010000))->1711805010000
TO_DURATION
Formats a TIME value as a human-readable duration using long English unit names. TIME values containing a date are shown as the elapsed local time since the Unix epoch.
TO_DURATION(TIME(...))
Examples:
TO_DURATION(TIME(49;2;3))->2 days, 1 hour, 2 minutes, 3 secondsTO_DURATION(TIME_MS(1234))->1 second, 234 milliseconds
Symbolic conversion
TO_SYMBOLIC
Suggests a simple fraction, a multiple of PI, or a square root close to the number you enter. This is an approximation based on the numeric value, so it cannot recover the original expression with certainty.
TO_SYMBOLIC(value)
Examples:
TO_SYMBOLIC(3/4)->FRAC(3;4)TO_SYMBOLIC(0.3333333333333333)->FRAC(1;3)TO_SYMBOLIC(9.42477796076938)->PI * 3TO_SYMBOLIC(1.4142135623730951)->SQRT(2)TO_SYMBOLIC(LAST)-> symbolic representation of the previous result
Terminal use
Start the calculator
The terminal version requires Node.js 18 or newer. Install Node.js from the official download page, then open a terminal in the app folder.
Start without an expression for an interactive session:
| Terminal | Start command |
|---|---|
| Any system with Node.js | node cli.js |
| Linux/macOS bash or zsh | ./appoc.sh |
| Windows Command Prompt | appoc.cmd |
| Windows PowerShell | .\appoc.cmd |
| macOS launcher | ./Appomatox\ CLI.command |
Enter an expression and press Enter to calculate. Use :quit, :q, or exit to leave the interactive session.
For a single calculation, add the expression in double quotes to any launcher. For example:
node cli.js "2+3*4"
The output is 14. In this single-calculation mode, the exit code is 0 for success or 1 for an input or calculation error.
Files and diagram output (terminal only)
| Command | Purpose |
|---|---|
:execute_file filename | Preview a UTF-8 text file and execute it after confirmation |
:save_last result.txt | Save the most recent result as text |
:save_last diagram.svg | Save the most recent diagram as SVG |
:export_history history.md | Export history as Markdown with separate SVG diagram files |
:chart output text | Show diagrams as terminal text (no extra renderer needed) |
:chart output chafa | Show diagrams using Chafa, if it is installed |
Use single quotes around filenames containing spaces, for example :execute_file 'my commands.md'. File execution runs non-empty lines that are not comments. In Markdown files, it runs only fenced code blocks labeled appo. The examples in this guide use that label for reusable calculation sequences.
History export writes those same appo blocks and saves diagrams in a sibling folder such as history-assets. Review a file's preview before confirming execution, since it can contain commands as well as calculations.
Troubleshooting
A function reports missing or invalid arguments
Check parentheses and separate arguments with ;, not a comma. For example, use ROUND(1/3;2). Put text in single quotes and lists in square brackets. Try Tab completion to check a function's spelling; the circle function is CIRLE.
A number looks wrong
Check the number format shown in the browser, or enter :locale to show the terminal setting. In German format, 1.234 means 1234; in US format it means a decimal number. Use :locale de for comma decimals or :locale us for point decimals. If a result starts with 0x or 0b, enter :mode dec for decimal output.
Trigonometry gives an unexpected result
Check Angle: DEG means degrees and RAD means radians. For SIN(90) to return 1, choose DEG or enter :angle deg. To calculate in radians, use :angle rad and inputs such as PI/2.
A diagram is blank or cuts off values
Enter :chart auto to remove previously fixed bounds. Use :chart scale stretch if you want the exact requested bounds to fill the available area. Add data with :draw; use :chart clear before starting a fresh diagram.
A geometry result contains ? or reports a conflict
? marks a value that cannot yet be calculated. Add enough independent measurements, such as all three sides of a triangle or two sides and their included angle. Check that your entered lengths and angles agree. If two triangles are possible, provide another independent measurement.
Stored variables are missing
Check that you are using the same browser profile and app location, or the same terminal user account. Browser and terminal values are stored separately. Browser storage may have been cleared or blocked; see persistence.
The phone keyboard has no letters
Set Keyboard above the operator buttons to Alphanumeric, then tap the input. Switch back to Numeric for number entry.
The terminal cannot find Node.js or the launcher
If node is not recognized, install Node.js from the official download page, restart your terminal, and check:
node -v
If a launcher is not found, open the terminal in the app folder. You can use node cli.js if a shell launcher cannot be started.
Function index
Select a function name to jump to its description. In the browser, use Find (Ctrl+F on Windows/Linux or Command+F on macOS) to search this page. Code examples have Copy buttons when JavaScript is available; paste multi-line examples into the calculator one line at a time.