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:
| Input | Interpretation |
|---|---|
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,567 | one number (outside calls) |
The 27 functions
| Function | Args | Meaning | Domain | Example |
|---|---|---|---|---|
sqrt | 1 | square root | x ≥ 0 | sqrt(16) → 4 |
abs | 1 | absolute value | any | abs(-3) → 3 |
round | 1–2 | rounding (away from zero); the 2nd argument is an integer digit count −15…15 | integer digits | round(2.5) → 3, round(2.345, 2) → 2.35 |
min | ≥1 | minimum | — | min(3, 1, 2) → 1 |
max | ≥1 | maximum | — | max(1, 2) → 2 |
sum | ≥1 | sum | — | sum(1, 2, 3) → 6 |
average | ≥1 | average | — | average(1, 2, 3) → 2 |
pow | 2 | power (same rules as ^) | finite result | pow(2, 10) → 1024 |
ln | 1 | natural logarithm | x > 0 | ln(1) → 0 |
log | 1–2 | logarithm: 1 argument — base 10; 2 arguments — base b | x > 0; b > 0, b ≠ 1 | log(100) → 2, log(8, 2) → 3 |
log10 | 1 | base-10 logarithm | x > 0 | log10(1000) → 3 |
sin | 1 | sine | radians | sin(0) → 0 |
cos | 1 | cosine | radians | cos(0) → 1 |
tan | 1 | tangent | radians | tan(0) → 0 |
asin | 1 | arcsine | |x| ≤ 1, radians | asin(1) → π/2 |
acos | 1 | arccosine | |x| ≤ 1, radians | acos(0) → π/2 |
atan | 1 | arctangent | any, radians | atan(1) → π/4 |
radians | 1 | degrees → radians | — | radians(180) → π |
degrees | 1 | radians → degrees | — | degrees(atan(1)) → 45 |
int | 1 | integer (decimal base) | exact integer | int(45) → 45 |
bin | 1 | integer in binary base | exact integer | bin(5) → 0b101 |
oct | 1 | integer in octal base | exact integer | oct(8) → 0o10 |
hex | 1 | integer in hexadecimal base | exact integer | hex(255) → 0xFF |
count | ≥1 | number of arguments | — | count(1, 2, 3) → 3 |
median | ≥1 | median | — | median(1, 2, 3, 4) → 2.5 |
stdev | ≥2 | sample standard deviation (n−1) | finite result | stdev(2,4,4,4,5,5,7,9) → ≈2.13809 |
rand | 2 | uniform integer in low...high, inclusive (system entropy) | exact integers, low ≤ high | rand(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.
Related
- Tags, subtotals & statistics — the full tags and
statistics feature behind
count,median,stdevandrand. - Variables & functions — the approachable guide to naming values and calling functions.
- Percentages — strict phrase patterns.
- Numbers & integer bases — base literals and display rules.