SQR — Square Root

Description
Section titled “Description”SQR (Square Root) writes the square root of Source to Dest every scan its rung is true. It is an output instruction with no state and no status bits. Use SQR to linearise a differential-pressure flow signal, find a side from an area, or compute a distance from the sum of two squares. Do not give SQR a negative Source expecting an error; the result is 0 and nothing faults, so range-check first when a negative input is possible.
Operands
Section titled “Operands”| Operand | Type | Format | Valid Range | Required | Description |
|---|---|---|---|---|---|
| Source | Any numeric tag, member, element or bit, or a literal | Tag, Tag.Member, Tag[n], Tag.bit, or a literal |
0 or greater; a negative gives 0 | Yes | The value to take the root of. |
| Dest | A writable numeric tag, member or element | Tag, Tag.Member, Tag[n] |
SINT, INT, DINT or REAL; not a literal, not an input pin | Yes | Where the root is written. |
Dest type. A root is rarely a whole number. A REAL Dest keeps the fraction; a whole-number Dest truncates it toward zero, so SQR 15 into an INT is 3.
Scan Behavior
Section titled “Scan Behavior”Prescan
Section titled “Prescan”Nothing. Dest keeps its power-up value.
Rung-condition-in is false
Section titled “Rung-condition-in is false”The instruction does nothing. Dest holds its last value.
Rung-condition-in is true
Section titled “Rung-condition-in is true”Source is read, its square root is computed and written to Dest every scan the rung is true. A negative Source writes 0.
Postscan
Section titled “Postscan”Nothing.
Example
Section titled “Example”Scenario: A cutting table is told the area of a square blank and must set the side length.
Tags:
Calc_Side— Compute side, BOOLArea— Blank area in square millimetres, REALSide— Side length in millimetres, REAL
Rung 1:
—] [Calc_Side———[SQR Area Side]———Scan 1 — Calc_Side = 0. Area reads 144. The rung is false: Side holds 0.

Scan 2 — Calc_Side = 1. Side reads 12.

A whole-number result paints without a decimal point even in a REAL. Type 150 into Area and Side shows 12.2474.
See Also
Section titled “See Also”- XPY — X to the Power of Y (
XPY Area 0.5is the same root) - CPT — Compute (
SQR(A*A + B*B)for a distance) - Math Functions — SIN, COS, TAN, ASN, ACS, ATN, LN, LOG, DEG, RAD
- Compute Instructions — Category index
Flow from differential pressure. Flow is proportional to the root of the pressure drop: SQR DP Root, then MUL by the meter constant, or CPT K * SQR(DP) in one instruction.
Negative input. RSLogix 500 takes the root of the absolute value and sets the sign flag; LadderIDE writes 0. Wrap the Source in ABS if the old behaviour is wanted.
The block never colours. Watch the rung wire and the Dest value line.
Applies to LadderIDE >=1.2.2 · Last reviewed 2026-09-11 · Screenshots verified 2026-09-11