EXPT

Returns the result of raising a base to an exponent.

Signature

     ┌─────────┐
IN1 ─┤         │
     │  EXPT   ├─ OUT
IN2 ─┤         │
     └─────────┘
FUNCTION EXPT : ANY_REAL
  VAR_INPUT
    IN1 : ANY_REAL;
    IN2 : ANY_NUM;
  END_VAR
END_FUNCTION

The return type matches the type of IN1. EXPT accepts REAL, LREAL for the base and any numeric type for the exponent.

Inputs

Name

Type

Description

IN1

ANY_NUM

The base.

IN2

ANY_NUM

The exponent.

Outputs

Name

Type

Description

Return value

ANY_NUM

IN1 raised to the power IN2. Same type as IN1.

Description

Returns IN1 raised to the power IN2. EXPT(a, b) computes ab. For integer types, the exponent must be non-negative. The operator form is **.

Example

result := EXPT(2, 10);       (* result = 1024 *)
value := 3 ** 4;             (* value = 81, operator form *)

See Also

  • EXP — natural exponential (ex)

  • SQRT — square root

  • ABS — absolute value

References