Skip to main content

Rolls and modifiers

Arithmetic and functions

Operators, precedence, decimals, and every supported math function.

Operators

Use +, -, *, /, % (remainder), ^ or ** (power). Powers precede multiplication/division/remainder, which precede addition/subtraction. Powers associate to the right: 2^3^2 means 2^(3^2). Parentheses override this order. Unary signs and decimals work; normalization simplifies +- and --.

One-argument functions

An argument can contain a full expression, including dice.

FunctionEffectExample
abs(x)Absolute valueabs(d6-4)
ceil(x)Round upwardceil(3d6/2)
floor(x)Round downwardfloor(3d6/2)
round(x)Nearest integer, following Math.roundround(d20/2)
sign(x)−1, 0, or 1sign(d20-10)
sqrt(x)Square rootsqrt(16)
exp(x)e to the power of xexp(1)
log(x)Natural logarithmlog(10)
sin(x)Sine in radianssin(d6)
cos(x)Cosine in radianscos(d6)
tan(x)Tangent in radianstan(d6)

Two-argument functions

min(a,b) returns the smaller value, max(a,b) the larger, and pow(a,b) computes a power. These differ from the minN/maxN modifiers, which transform each face.

Division by zero and functions producing a non-finite result raise NON_FINITE_RESULT. Intermediate operations follow decimal12-v1; the final total has two decimal places.

Try the examples