Skip to main content

power

Returns the result of a number raised to a power.

Parameters

  • X (number)

    The base number.

  • Y (number)

    The exponent.

  • DECIMAL PLACES (number)

    Optional. The number of decimal places for the result.

    Default: Uses the number of decimal places in the default number format pattern — unless all numbers used in the calculation have been formatted identically (using a formatting function), in which case the result is displayed using that formatting.

  • STRIP TRAILING ZEROS (Boolean)

    Optional. Whether to strip trailing zeros from the result (true) or leave them in place (false).

    Default: Strips or keeps trailing zeros based on the default number format pattern — unless all numbers used in the calculation have been formatted identically (using a formatting function), in which case the result is displayed using that formatting.

Important

In legacy projects, the default for DECIMAL PLACES is 7, and the default for STRIP TRAILING ZEROS is true. For more about legacy projects, see Legacy behaviors.

Examples

Assume the settings in Settings > Number and Currency are:

Setting

Value

NUMBER FORMAT

#,##0.##

If the optional parameters are unspecified, the project setting applies.

ATL in Script

Result

[[power(1.25, 3)]]

1.95

Use the third parameter to define the number of decimal places.

ATL in Script

Result

[[power(1.25, 3, 3)]]

1.953

[[power(1.25, 3, 5)]]

1.95313

Set the fourth parameter to false to include trailing zeros.

ATL in Script

Result

[[power(2, 3, 4)]]

8

[[power(2, 3, 4, false)]]

8.0000