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. The compiler converts IN2 to
that type first. EXPT accepts REAL, LREAL for the base and any
numeric type for the exponent.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The base. |
|
|
The exponent. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
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¶
References¶
IEC 61131-3 §2.5.1.5.2