Appomatox Calculator Help

Appomatox Calculator is available in a browser and as a terminal CLI (Windows cmd/PowerShell and Linux/macOS bash/zsh).

Run In Browser

Open index.html directly in your browser.

The app automatically uses a file:// compatible standalone bundle when opened from disk.

Run In Terminal

One-shot expression

Pass an expression to any CLI launcher:

node cli.js "2+3*4"
# Linux/macOS
./appoc.sh "2+3*4"
# Windows Command Prompt
appoc.cmd "2+3*4"
# Windows PowerShell
.\appoc.cmd "2+3*4"
# macOS terminal
./Appomatox\ CLI.command "2+3*4"

Expected output:

14

Interactive mode

Start any launcher without an expression:

node cli.js
./appoc.sh
appoc.cmd
.\appoc.cmd
./Appomatox\ CLI.command

Interactive commands:

History navigation keys (interactive input):

File names without whitespace may be entered directly; names with whitespace require single quotes, for example :execute_file 'my commands.md'. :execute_file previews the file, then runs every non-empty, non-comment line after confirmation. For Markdown files, only fenced blocks marked appo are executed. :export_history writes that same reusable appo-block format and places diagram SVG files in a sibling -assets directory.

Function And Command Completion

Function and command suggestions are generated automatically from the registered definitions.

Expression Rules

Allowed characters:

Result display uses your system's default locale formatting with thousand separators. Example in German locale: 1234 is shown as 1.234.

Input also accepts thousand separators using your default locale format.

Invalid characters are rejected.

Functions

Functions use semicolons (;) to separate arguments, which avoids ambiguity with the locale decimal separator.

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, one-dimensional numeric list.

MIN([]) and MAX([]) are undefined and produce an error. The two-argument form can also be used inside FORMULA expressions.

Function names are case-insensitive.

ROUND

Rounds a value to the given number of decimal places.

Examples:

SQRT

Returns the square root of a value.

Examples:

SUM and PRODUCT

Evaluate an expression or a FORMULA value for every integer in an inclusive range.

Examples:

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.

Examples:

TOHEX

Converts an integer value to hexadecimal text.

Examples:

TOBIN

Converts an integer value to binary text.

Examples:

TODEC

Converts a fraction value to decimal output.

Examples:

Integers and number theory

GCD

Returns the greatest common divisor of two integer values.

Examples:

EVEN and ODD

Test whether an integer is even or odd. Both functions return either 0 or 1.

Examples:

LCM

Calculates the non-negative least common multiple of two integers.

FACTORS

Returns the prime factorization of an integer as a list. Repeated prime factors remain repeated, and negative values start with -1.

Prime factorization is not defined for zero, so FACTORS(0) returns an error.

FACTORIAL

Returns the factorial of a non-negative integer value.

Examples:

Random values and identifiers

GUID

Returns a new GUID/UUID string.

Example:

RANDOM

Returns a random integer between 0 and the given positive maximum, inclusive.

Example:

RANDOM_PWD

Returns a random string with 40 characters. The string can contain lowercase letters, uppercase letters, numbers, and these symbols:

! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ { | } ~ `

Example:

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.

Examples:

BASE64

Converts a string value to base64 text. Single quotes inside the string can be escaped with \', and \n inserts a newline.

Examples:

DEBASE64

Decodes base64 text back to a string value.

Examples:

Statistics

STAT_SUM

Calculates the sum of a one-dimensional numeric LIST, SET, or SERIES.

Examples:

STAT_AVG

Calculates the average of a one-dimensional numeric LIST, SET, or SERIES.

Examples:

STAT_MEDIAN

Calculates the median of a one-dimensional numeric LIST, SET, or SERIES.

Examples:

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_SUM([value; ...]) continues to calculate the sum as described above.

Examples:

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.

Example:

RSHIFT

Shifts an integer value to the right.

Example:

XOR

Applies bitwise XOR to two integer values.

Example:

OR

Applies bitwise OR to two integer values.

Example:

AND

Applies bitwise AND to two integer values.

Example:

Exact values and lists

FRAC

Creates an exact fraction value. Fractions are kept exact internally and stay exact in calculations as long as no float is involved.

Examples:

Mixing fractions with floats produces a float result.

Examples:

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.

Examples:

Arithmetic operators are not applied to whole lists. Functions such as STAT_SUM validate the required list shape.

Variables and formulas

Calculation models

Calculation models represent connected values and derive consistent missing fields without storing a mutable global object. TRIANGLE and CIRLE use named fields and semicolons, and each call is independent.

TRIANGLE

TRIANGLE(GAMMA=...; A=...; B=...) represents a triangle where A, B, and C are side lengths and GAMMA is the angle opposite C. All angles use the active trigonometric angle mode (DEG or RAD). The model also provides ALPHA, BETA; heights HA, HB, HC; medians MA, MB, MC; angle bisectors WA, WB, WC; AREA, PERIMETER, SEMIPERIMETER, INRADIUS, CIRCUMRADIUS, and the P/Q sections of side C. Descriptive aliases such as SIDE_A, ANGLE_GAMMA, HEIGHT_A, MEDIAN_A, and BISECTOR_A are accepted.

Triangle values

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 ?.

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

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.

Circle values

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.

FORMULA, collections, POINT, SERIES, and EVAL

Creates, stores, and evaluates a mathematical formula with one named parameter.

Examples:

Formula expressions may use their parameter, built-in constants such as PI, and deterministic 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.

POINT creates a finite two-dimensional point value for the drawing editor. It accepts either one coordinate pair or several bracketed pairs:

LIST preserves the order and duplicate occurrences of its values. SET accepts numbers and strings, removes duplicates, and is used for comparisons. SERIES creates a connected numeric measurement series; its X coordinates are the measurement numbers starting at 1. A SERIES remains a diagram value, but the numeric functions (STAT_*, MIN, and MAX) accept it directly as a numeric sequence.

UNION, INTERSECT, DIFF, and SYMDIFF accept every combination of LIST, SET, and SERIES and always return a SET. Convert a sequence with LIST(sequence), SET(sequence), or SERIES(sequence); the SERIES conversion requires a non-empty sequence containing only numeric 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.

Charts

:draw and :chart

:draw draws two-dimensional POINT values, connected SERIES measurements, TRIANGLE vertices, and continuous FORMULA curves in the browser or terminal.

Examples:

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 are sampled at a higher horizontal resolution than the browser SVG viewport and rendered as connected paths. Undefined values split the curve into separate segments, preventing lines across common discontinuities. Without explicit chart bounds, :draw evaluates formula curves over an X range from -10 to 10; setting new bounds resamples existing formula curves across the complete visible X range.

Powers, logarithms, and general mathematics

Logarithm values must be greater than zero. These functions can also be used inside FORMULA expressions.

Examples:

Trigonometry, hyperbolic functions, and angle conversion

The circular trigonometric functions use the active angle mode. RAD is the default.

Examples:

The hyperbolic functions are independent of the angle mode:

Explicit conversion functions also work independently of the active mode:

Time and date

TIME

Creates a TIME value.

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:

TIMENOW

Returns the current local date and time as a TIME value.

Example:

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 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.

Examples:

TIME_NS

Creates a TIME value from nanoseconds.

Examples:

TIME_MICROS

Creates a TIME value from microseconds.

Examples:

TODAY, TOHOUR, TOMIN, TOSEC, TOMS, TOMICROS, TO_NS

Convert a TIME value to a numeric total in the named unit.

Examples:

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.

TIMESEC, TIMEMIN, TIMEHOUR, TIMEDAY

Create TIME values from integer seconds, minutes, hours, or days. The resulting values support the same arithmetic operations as other TIME values.

Examples:

TIME1970

Converts a unix epoch value to TIME(...). Input can be in seconds, milliseconds, microseconds, or nanoseconds.

Examples:

TO_TIME1970

Converts a TIME(...) value (with date fields) to unix epoch milliseconds.

Examples:

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.

Examples:

Symbolic conversion

TO_SYMBOLIC

Finds the simplest plausible symbolic representation of a finite numeric value. It compares fractions, rational multiples of PI, and square roots using the same floating-point tolerance and rejects unnecessarily complex representations.

Examples:

Variables

Variables are case-insensitive and can be used directly in expressions.

When replacing or removing an existing variable, the browser and interactive terminal ask for confirmation first.

Examples:

Predefined Read-only Variables

These variables are built in and cannot be overwritten:

Examples:

Implicit multiplication with variables is supported, for example:

LAST

LAST contains the previous successful calculation result. _ is a read-only alias for LAST.

Example:

Persistence

Variables persist across sessions.

Binary And Hex Literals

You can enter binary and hexadecimal numbers directly in expressions.

Examples:

Output Modes

The calculator supports three output modes:

In hex mode, numeric results are shown with 0x prefix. In binary mode, numeric results are shown with 0b prefix.

Browser:

CLI:

Exit Codes (One-shot mode)

This makes the CLI suitable for shell scripts and automation.

Troubleshooting

If node or npm is not recognized:

  1. Install Node.js from the official installer.
  2. Restart your terminal.
  3. Verify:
node -v
npm -v