Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

ABS

Returns the absolute value of a numeric input.

IEC 61131-3

Section 2.5.1.5.2

Support

Supported

Signatures

#

Input (IN)

Return Type

Support

1

SINT

SINT

Not yet supported

2

INT

INT

Not yet supported

3

DINT

DINT

Supported

4

LINT

LINT

Not yet supported

5

REAL

REAL

Supported

6

LREAL

LREAL

Supported

Description

Returns the absolute value of IN. For signed integer types, the result of ABS applied to the most negative value is undefined because the positive value cannot be represented.

Example

result := ABS(-42);    (* result = 42 *)
value := ABS(REAL#-3.14);  (* value = 3.14 *)

See Also

  • SQRT — square root

  • EXPT — exponentiation