SQRT

Returns the square root of a numeric input.

Signature

    ┌─────────┐
IN ─┤  SQRT   ├─ OUT
    └─────────┘
FUNCTION SQRT : ANY_REAL
  VAR_INPUT
    IN : ANY_REAL;
  END_VAR
END_FUNCTION

The return type matches the input type. SQRT accepts REAL, LREAL.

Inputs

Name

Type

Description

IN

ANY_REAL

The non-negative value to compute the square root of.

Outputs

Name

Type

Description

Return value

ANY_REAL

The square root of IN. Same type as IN.

Description

Returns the square root of IN. The input must be non-negative; the result of SQRT applied to a negative value is undefined.

Example

result := SQRT(REAL#9.0);    (* result = 3.0 *)
value := SQRT(LREAL#2.0);   (* value = 1.41421356... *)

See Also

  • ABS — absolute value

  • EXPT — exponentiation

  • EXP — natural exponential

References