Square Root Function
- Updated2025-03-14
- 4 minute(s) read
Computes the square root of the input value.
If x is negative, the square root is NaN unless x is complex. If x is a matrix, this function takes the matrix square root of x. The connector pane displays the default data types for this polymorphic function.

Inputs/Outputs
![]() x can be a scalar number, array or cluster of numbers, array of clusters of numbers, and so on. ![]() sqrt(x) is a double-precision, floating-point number if x is an integer. If x is less than 0, sqrt(x) is not a number (NaN), unless x is complex. When x is of the form x = a + bi, that is, when x is complex, the function defines the magnitude and phase with the following equations:
Note You can manually configure this function to output data of a type you want. To specify the output data type, right-click the function and select Properties to display the Object Properties dialog box. On the Output Configuration page, click the Representation icon and select the data type you want. A blue coercion dot appears on the output terminal of the function to indicate that you have configured the output data type. |
When you wire matrix data as an input to this function, a VI that includes subVIs that work with the matrix data type replaces the function. The resulting VI has the same icon but contains a matrix-specific algorithm. The node remains a VI if you disconnect the matrix from the input(s). Wire other data types as inputs to restore the original function. If you wire a data type to a function and that data type causes a basic math operation to fail, the function returns an empty matrix or NaN.
Refer to the Matrix Square Root VI for more information.
Fixed-Point Details
If you wire a signed fixed-point value to this function, the function converts the signed number into a floating-point number and performs the square root operation. By default, LabVIEW configures the integer word length of the square root to avoid overflow. However, because the precision of the square root can be infinite, rounding conditions always occur. Use the Numeric Node Properties dialog box to configure how LabVIEW handles overflow and rounding of fixed-point data.
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
Single-Cycle Timed Loop | Not supported. |
Usage | If you use this function with the single-precision floating-point data type, refer to the Using the Single-Precision Floating-Point Data Type and Deciding Which Data Type to Use in FPGA Designs topics for resource use, latency, and single-cycle Timed Loop support implications. |
Timing | If the fractional word length of sqrt(x) is larger than half of the fractional word length of x, the function requires clock cycles in proportion to the number of bits in sqrt(x). Otherwise, the required clock cycles are proportional to the number of bits in x. |
Resources | In general, the function requires FPGA resources proportional to the number of bits in x and sqrt(x). If you use this function with the fixed-point data type, the overflow and rounding modes might impact resources. |
Notes | You also can use the High Throughput Square Root function to perform fixed-point math and analysis on an FPGA target. |
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Numerics\Numeric Functions.vi