exprv4:reference:functions:algebra




Algebra Functions

Algebra built-in functions perform common power and root calculations.


cbrt(x)

Returns the cube root of a number.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

cbrt(27);       // 3

cube(x)

Returns `x * x * x`.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

cube(3);        // 27

pow(base, exponent)

Raises `base` to `exponent`.

Argument Type Description
`base` number Base value.
`exponent` number Exponent value.

Returns: number.

Errors:

  • `0` raised to a negative exponent is invalid.
  • A negative base with a non-integer exponent is not supported.
  • Overflow is reported as an error.

Example:

pow(2, 8);      // 256

sqr(x)

Returns `x * x`.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

sqr(12);        // 144

sqrt(x)

Returns the square root of a number.

Argument Type Description
`x` number Input value. Must be greater than or equal to zero.

Returns: number.

Example:

sqrt(25);       // 5

Previous: Arithmetic

Next: Logarithmic and Exponential

exprv4/reference/functions/algebra.txt · Last modified: by 127.0.0.1

Page Tools