LabVIEW exhibits different conversion behaviors, depending 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, LabVIEW converts one of the inputs to match the other.
LabVIEW chooses the data type that uses more bits in order to retain as much precision as possible. If the number of bits is the same, LabVIEW chooses unsigned over signed to retain as much precision as possible.
The following table describes how LabVIEW converts numeric data types.
|Original Type||Converted Type||LabVIEW Conversion Behavior||Behavior Details|
|Signed or unsigned integer||Floating-point number||LabVIEW coerces the data 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, LabVIEW maintains as much precision as possible in the conversion.|
|Floating-point number||Signed or unsigned integer||
LabVIEW coerces in-range values to a signed or unsigned integer.
LabVIEW coerces out-of-range values 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, LabVIEW extends the sign of a signed source and places zeros in the extra bits of an unsigned source.
If the source is larger than the destination, LabVIEW copies only the least significant bits of the value.
|LabVIEW does not coerce out-of-range values to the minimum or maximum value of an integer. LabVIEW attempts to retain as much precision as possible when converting between integer types.|
|Integer, floating-point, or fixed-point number||Fixed-point number||
LabVIEW coerces values outside the desired range for the fixed-point number 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.|