Skip to main content
These cover core arithmetic, percent change, modulo, powers, roots, logarithms, and exponential functions. Every operation works on a number or a table, returning the same shape it was given. For operator precedence and the comparison and logical operators, see Operators and precedence.

Core arithmetic

Each operation accepts two numbers, a number and a table, or two tables — producing a new table when a table is involved. Two tables must be the same length, or an Invalid dimensions error is returned. Dividing by 0 returns a Division by 0 error; 1 / value returns the reciprocal of value.

Percent change [ch]

Returns value adjusted by a percentage change (entered as a decimal): a positive change adds, a negative change subtracts. This is the financial calculator equivalent of value + change% or value - change%, which a spreadsheet would write as value ± (value * change%). With periods, it compounds the change over that many periods (compound annual growth rate). value can be a number or a table.

Modulo [mod]

The remainder of value1 divided by value2. A value2 of 0 returns a Division by 0 error. Either argument can be a number or a table; if both are tables they must be the same length, or Invalid dimensions is returned. If value1 or value2 is too large to calculate then returns ‘Parameter out of range’ error.

Powers and roots

Power [^]

Raises value to the x power. value can either be a number or table where the same is returned. Several forms are common:
  • value ^ 2, value ^ 3 — squared, cubed.
  • value ^ -1 — the reciprocal of value (see also division).
  • value ^ (1/2) — the square root, the same as sqrt(value).
  • value ^ (1/x) — the xth root, the same as root(value; x).

Square root [sqrt]

The square root of value. value can either be a number or table where the same is returned.

Root [root]

The xth root of value. root(value; 2) is the same as sqrt(value). value can either be a number or table where the same is returned.

Logarithms and exponentials

Natural logarithm [ln]

The natural logarithm (base e) of value. value can either be a number or table where the same is returned.

Exponential [exp]

The constant e (2.718281828459045) raised to value. value can either be a number or table where the same is returned. There is no e constant; write exp(1) when you need e itself.

Logarithm [log]

The logarithm of value in base 10, or in base. value can either be a number or table where the same is returned. base must be a whole number ≥ 2; real numbers are truncated, and values outside the range return a Parameter out of range error.

Antilogarithm [alog]

The inverse (base 10) logarithm of value. value can either be a number or table where the same is returned.