Numlex Documentation
Syntax Reference
Report issue

Built-in functions

All 27 math functions with arity, domains and examples, plus call syntax, nesting and argument separators.

Numlex ships exactly 27 built-in functions — all scalar, all strict. There is no e or pi built in, calls are case-insensitive, and a call that is misspelled or given the wrong number of arguments is a visible error rather than a zero.

This page lists the call rules, the argument-separator behavior that follows the regional number format (round(1.25, 0) versus round(1,25; 0)), and a complete table of the 27 functions with their domains and examples.

Call syntax

Write name(arg1, arg2, …). Function names are case-insensitive (SQRT(9) = sqrt(9)), and a space before ( is allowed.

Calls are strict. An unknown name, the wrong number of arguments, a missing or extra comma, an unclosed parenthesis, or a value outside the function’s domain is an error — never a guess. A call-shaped line follows the strict rules described in Sheet language: an unknown function name is an error rather than a parenthesized group.

In call position a built-in function takes precedence over a variable with the same name — sum = 5 does not stop sum(1, 2). Everywhere else, sum is an ordinary identifier.

Functions are scalar (they do not take or return units), and nested calls are allowed: sqrt(abs(-16)) → 4.

No built-in constants

There are no built-in e or pi constants. ln(e) does not evaluate unless e itself was declared first (e = 2.71828…). The same applies to pi: declare it as a named value or a Settings constant if you need it.

Argument separators and commas

The separator follows the regional number format:

  • Dot-decimal formats (North America, System with a dot): the argument separator is , — round(1.25, 0).
  • Comma-decimal formats (Western Europe, Eastern Europe, System with a comma): the decimal separator is a comma and the argument separator is ; — round(1,25; 0) = 1.

Commas inside a call are read by shape:

InputInterpretation
sum(1,234)one number (1234) — a grouping comma needs exactly three digits after it and an integer part before it
sum(1, 234)two arguments
sum(1,2,3)three arguments
1,234,567one number (outside calls)

The 27 functions

FunctionArgsMeaningDomainExample
sqrt1square rootx ≥ 0sqrt(16) → 4
abs1absolute valueanyabs(-3) → 3
round1–2rounding (away from zero); the 2nd argument is an integer digit count −15…15integer digitsround(2.5) → 3, round(2.345, 2) → 2.35
min≥1minimum—min(3, 1, 2) → 1
max≥1maximum—max(1, 2) → 2
sum≥1sum—sum(1, 2, 3) → 6
average≥1average—average(1, 2, 3) → 2
pow2power (same rules as ^)finite resultpow(2, 10) → 1024
ln1natural logarithmx > 0ln(1) → 0
log1–2logarithm: 1 argument — base 10; 2 arguments — base bx > 0; b > 0, b ≠ 1log(100) → 2, log(8, 2) → 3
log101base-10 logarithmx > 0log10(1000) → 3
sin1sineradianssin(0) → 0
cos1cosineradianscos(0) → 1
tan1tangentradianstan(0) → 0
asin1arcsine|x| ≤ 1, radiansasin(1) → π/2
acos1arccosine|x| ≤ 1, radiansacos(0) → π/2
atan1arctangentany, radiansatan(1) → π/4
radians1degrees → radians—radians(180) → π
degrees1radians → degrees—degrees(atan(1)) → 45
int1integer (decimal base)exact integerint(45) → 45
bin1integer in binary baseexact integerbin(5) → 0b101
oct1integer in octal baseexact integeroct(8) → 0o10
hex1integer in hexadecimal baseexact integerhex(255) → 0xFF
count≥1number of arguments—count(1, 2, 3) → 3
median≥1median—median(1, 2, 3, 4) → 2.5
stdev≥2sample standard deviation (n−1)finite resultstdev(2,4,4,4,5,5,7,9) → ≈2.13809
rand2uniform integer in low...high, inclusive (system entropy)exact integers, low ≤ highrand(1, 6)

Statistics, tags and subtotals

The last four functions — count, median, stdev and rand — belong to the tags, subtotals and statistics workflow: tagged rows, --- sections, subtotals, grand totals, tag aggregates, the natural statistics phrases and the configurable footer statistic. Their semantics (eligibility, above-only tag queries, the dynamic rand value and the footer menu) are documented in Tags, subtotals & statistics; this page covers their call syntax only.

rand(low, high) is a uniform inclusive integer drawn from system entropy. It stays stable until you edit the sheet or press ⌘R (Recalculate Dynamic Values), and it is never tokenizable and never part of the Previous Answer chain; PDF export freezes the current value.

Integer functions with bases

int, bin, oct and hex return an exact integer with the requested base representation when the value is an exact integer (hex(255) → 0xFF); otherwise they return a strict integer value.

The exact-integer rules — how expressions enter them, their precedence and their overflow behavior — are documented in Operators & logic and Numbers & integer bases.

Found an issue in these docs? Report it on GitHub