2.5.4.81 Pow

The Pow function performs an exponentiation calculation.

ABNF:

 Pow = val val " POW():128"

Required Arguments:

Name: Base

Type: vDouble

An argument that specifies the number to be raised to the power of Exponent.

Name: Exponent

Type: vDouble

An argument that specifies the exponent by which to raise Base.

Return Value:

Type: vNum, PtgErr

This function returns a vNum or PtgErr containing Base raised to the power of Exponent. The type of the return value is calculated by the following algorithm.

SET returnType = PtgNum

SET returnError = #NUM!

SET returnDimension = 0

IF Base.Value = 0 THEN

            IF Exponent.Value = 0 THEN

                        SET returnType = PtgErr

                        SET returnError = #NUM!

            ELSE IF Exponent.Value < 0 THEN

                        SET returnType = PtgErr

                        SET returnError = #DIV/0

            END IF

ELSE IF Base.Value < 0 AND Exponent is not an integer THEN

            SET returnType = PtgErr

            SET returnError = #DIM!

ELSE IF Base.Unit = PtgNumPctTHEN

            SET returnType = PtgNumPct

            SET returnDimension = 1

ELSE

            SET returnType = Base.Unit

            SET returnDimension = Base.Dimension * Exponent.Value

END IF

IF returnType = PtgErr THEN

            Return type is PtgErr with error code of returnError

ELSE IF returnDimension = 0 THEN

            Return type is PtgNum

ELSE IF returnDimension = 1 THEN

            Return type is returnType

ELSE

            Return type is PtgNumMultiDim with unit = returnType and dimension = returnDimension

END IF