SQRT
Calculates the square root of Value and stores the result in Result.
Ladder Representation
Block Structure
| Variable Type | Name | Data Type | Description |
|---|---|---|---|
| VAR_INPUT | EN | BOOL | Block enabling. |
| VAR_INPUT | Value | REAL | Reference variable for the operation. |
| VAR_OUTPUT | Done | BOOL | End of operation. |
| VAR_OUTPUT | Result | REAL | Variable that stores the operation result. |
Operation
When EN is TRUE, the block writes the square root of Value to Result.
If the operation completes without errors, Done is set. If an operation error occurs, Done remains FALSE and Result keeps its previous value.
When EN is FALSE, Result remains unchanged and Done remains FALSE.
Execution Flowchart

Examples
- Ladder Example
- Structured Text Example
This example calculates the square root of VALUE and stores the final result in RESULT. The block completes successfully and activates Done.
This example attempts to calculateste the square root of a negative VALUE. The block reports an execution error, leaves RESULT unchanged, and keeps Done disabled.
The following Structured Text code applies the same logic shown in the Ladder example.
Structured Text
VAR
VALUE : REAL := 81.0;
RESULT : REAL;
END_VAR
RESULT := FB_SQRT(EN:=DI1, Value:=VALUE, Done=>DO1);