Sqrt
Calculates the square root, the signed square root, or the inverse of the square root.
blockType: Sqrt
Reciprocal Square Root Path in the library:
|
|
SignedSqrt Path in the library:
|
|
Sqrt Path in the library:
|
Description
Block Sqrt calculates the square root, the signed square root, or the inverse of the square root of the input signal.
The function calculated by the block and the block icon depend on the parameter value. Function.
| Parameter Value Function | Description | Mathematical expression | The block icon |
|---|---|---|---|
|
The square root of the input signal |
|
|
|
The square root of the absolute value of the input signal multiplied by the sign of the input signal |
|
|
|
The inverse of the square root of the input signal |
|
Ports
Input
#
IN_1
—
The input signal
scalar | vector | the matrix
Details
The input signal for calculating the square root, the signed square root, or the inverse of the square root.
| Data types |
|
| Complex numbers support |
Yes |
Output
#
OUT_1
—
The output signal
scalar | vector | the matrix
Details
The output signal, which is the value of the square root, the signed square root, or the inverse of the square root, calculated from the input signal.
If the input signal is represented by integer data, then the output signal must be of the floating-point data type.
| Data types |
|
| Complex numbers support |
No |
Parameters
Parameters
#
Function —
the function that the block performs
sqrt | signedSqrt | rSqrt
Details
The mathematical function that the block calculates. The block icon changes according to the selected function.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Output signal type —
type of output signal
auto | real | complex
Details
Specify the type of output signal.
Function |
Input signal type |
Type of output signal |
||
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
Main
#
Intermediate results —
the data type of the intermediate results
Inherit: auto | Inherit from input | Inherit from output | Float64 | Float32 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point
Details
Specify the data type for the intermediate results for the block Sqrt or Reciprocal Square Root.
The type can be inherited or specified directly.
To avoid overflow, the data type for intermediate results must be greater than or equal to the data type that can contain the square of the output data type.
Follow these guidelines for explicitly specifying an intermediate data type for a block. Sqrt:
| Type of input and output data | The type of intermediate data |
|---|---|
The input or output data has double precision. |
Use a double precision data type. |
The input or output data has single precision, and any non-single data type is not double precision. |
Use a single or double precision data type. |
The input and output data have a fixed point. |
Use a fixed-point data type. |
Follow these guidelines for explicitly specifying an intermediate data type for a block. Reciprocal Square Root:
| Type of input and output data | The type of intermediate data |
|---|---|
The input data has double precision, and the output data is not single precision. |
Use a double precision data type. |
The input data is not single precision, and the output data is double precision. |
Use the double precision data type. |
The input and output data have a fixed point. |
Use a fixed-point data type. |
Do not set the data type of the intermediate results Inherit from output in the following cases:
-
The input data type is floating point;
-
The output data type is fixed—point.
In these cases, the choice is Inherit from output leads to suboptimal performance and error occurrence.
To avoid this error, convert the input signal from a floating-point data type to a fixed-point data type. For example, insert a block Data Type Conversion before the block Sqrt to perform the conversion.
Dependencies
To use this parameter, set for the parameter Function meaning sqrt or rSqrt.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Intermediate results fixed-point type —
the type of intermediate data with a fixed point
Data type
Details
Specify the type of intermediate data with a fixed point.
Dependencies
To use this parameter, set for the parameter Function meaning sqrt or rSqrt, and for the parameter Intermediate results meaning Fixed-point.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Output —
type of output data
Inherit: auto | Same as first input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point
Details
Specify the type of output data. The type can be inherited or specified directly.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Output fixed-point type —
the type of fixed-point output
Data type
Details
Specify the type of fixed-point output.
Dependencies
To use this parameter, set for the parameter Output meaning Fixed-point.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Integer rounding mode —
rounding mode for fixed point operations
Ceiling | Convergent | Floor | Nearest | Round | Zero
Details
Select the rounding mode for fixed-point operations. You can choose:
-
Floor— rounds down both positive and negative numbers (towards negative infinity); -
Ceiling— rounds up both positive and negative numbers (towards positive infinity); -
Convergent— rounds the number to the nearest representable value. If the fractional part of the number ends in5, the number is rounded to the nearest even integer; -
Nearest— rounds the number to the nearest representable value. If the fractional part of the number ends in5, the number is rounded up (towards positive infinity); -
Round— rounds the number to the nearest integer;
-
Zero— rounds the number towards zero.
The block parameters are always rounded to the nearest representable value.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Saturate on integer overflow —
method of action in case of overflow
Logical
Details
When this check box is selected, the value that goes beyond the type limits is reset to the maximum or minimum value that the selected data type can represent. Otherwise, overflow transfer occurs.
For example, the maximum value that can represent a signed 8-bit integer Int8, equal to 127. Any result of a block operation exceeding this maximum value causes an overflow of an 8-bit integer.
When this check box is selected, the output of the block reaches saturation at 127. Similarly, the output of the block reaches saturation at the minimum output value. −128.
When unchecked, the block interprets the overflow-causing value as Int8, which may lead to an unintended result. For example, the result 130 (binary number 1000 0010), expressed as Int8, is equal to −126.
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |