Skip to content

power - Raise a value to a given exponent

The power function simulates raising a number to the power of an exponent.

Syntax

Like many functions in DataPrime, power supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

power(number: number, exponent: number): number
number: number.power(exponent: number): number

Arguments

NameTypeRequiredDescription
numbernumbertrueThe number to raise to the exponent, otherwise known as the base
exponentnumbertrueThe exponent to which the base shall be raised, for example 2 is the equivalent of squaring our base

Example - Basic usage

If we have a numeric value, num and we wish to square it, we can do so with the following command:

create num_squared from power(num, 2)
create num_squared from num.power(2)