By default, a data type with fewer bits changes to match the data type with more bits. If the number of bits is the same, unsigned data types are chosen over signed data types to retain as much precision as possible.
Conversion behaviors depend on the data types you are converting between or the node accepting the data. For example, if you wire two different data types to a node that expects matching data types, one of the inputs is converted to match the other.
|Original Type||Converted Type||Conversion Behavior||Behavior Details|
|Signed or unsigned integer||Floating-point number||Data is coerced to the nearest value possible.||This conversion is exact when the floating-point number is more precise than the integer. If the integer is more precise than the floating-point number, the floating-point data type maintains as much precision as possible in the conversion.|
|Floating-point number||Signed or unsigned integer||
In-range values are coerced to a signed or unsigned integer.
Out-of-range values are coerced to the minimum or maximum value of the integer.
|This conversion is less precise if the floating-point number is an out-of-range value. For example, unsigned integers represent only non-negative integers. If you convert a negative floating-point number to an unsigned integer, the result is 0.|
If the source is smaller than the destination, the sign of a signed source is extended and zeros are placed in the extra bits of an unsigned source.
If the source is larger than the destination, the destination retains only the least significant bits of the source value.
|Out-of-range values are not coerced to the minimum or maximum value of an integer. The software attempts to retain as much precision as possible when converting between integer types.|
|Integer, floating-point, or fixed-point number||Fixed-point number||Values outside the desired range for the fixed-point number are coerced to within the maximum and minimum values of the fixed-point number.||Refer to the Numeric Coercion in the Fixed-Point Data Type topic for more information about coercing the fixed-point data type.|