Skip to content

SQR — Square Root

Category
Compute
Type
Output
Availability
All platforms

SQR instruction block: Source Area, Dest Side


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.


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.


Nothing. Dest keeps its power-up value.

The instruction does nothing. Dest holds its last value.

Source is read, its square root is computed and written to Dest every scan the rung is true. A negative Source writes 0.

Nothing.


Scenario: A cutting table is told the area of a square blank and must set the side length.

Tags:

  • Calc_Side — Compute side, BOOL
  • Area — Blank area in square millimetres, REAL
  • Side — 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.

Figure 1 — SQR rung false: Area 144, Side 0, rung dark

Scan 2 — Calc_Side = 1. Side reads 12.

Figure 2 — SQR rung true: Side reads 12, rung lit

A whole-number result paints without a decimal point even in a REAL. Type 150 into Area and Side shows 12.2474.


  • XPY — X to the Power of Y (XPY Area 0.5 is 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