Reference pow()

pow()

Calculates exponential expressions such as 23.

For example, pow(2, 3) evaluates the expression 2 × 2 × 2. pow(2, -3) evaluates 1 ÷ (2 × 2 × 2).

pow() can also be used in shaders with p5.strands. The following example uses pow() to create a gamma curve effect on colors in a shader.

Examples

Syntax

pow(n, e)

Parameters

n
Number: base of the exponential expression.
e
Number: power by which to raise the base.

Returns

Number: n^e.

Related References