Numlex Documentation
Syntax Reference

Built-in functions

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

Main branch reference after R89 · released versions may differ docs/SYNTAX_REFERENCE.md @ 1ebc752

Numlex ships exactly 23 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 23 functions with their domains and verified 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 — deterministically, never a guess. A call-shaped line is part of the strict contract 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 23 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≥1minimummin(3, 1, 2) → 1
max≥1maximummax(1, 2) → 2
sum≥1sumsum(1, 2, 3) → 6
average≥1average (overflow-safe)average(1, 2, 3) → 2
pow2power (same contract 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 → radiansradians(180) → π
degrees1radians → degreesdegrees(atan(1)) → 45
int1integer (decimal base)exact integer, Int64int(45) → 45
bin1integer in binary baseexact integer, Int64bin(5)0b101
oct1integer in octal baseexact integer, Int64oct(8)0o10
hex1integer in hexadecimal baseexact integer, Int64hex(255)0xFF

Integer functions and lanes

int, bin, oct and hex behave according to the lane they are called on:

  • On the exact integer lane, they return an exact Int64 with their base representation (so hex(255)0xFF).
  • On the scalar (Double) lane, they return a strict integer value.

The lane itself — how lines enter it, its precedence and its overflow rules — is documented in Operators & logic and Numbers & integer bases.

Found an issue in these docs? Report it on GitHub .