# Conversion Behaviors

Last Modified: September 25, 2017

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.
Integer Integer

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. Note

Enums are treated as unsigned integers. For example, if you convert -1, a floating-point number, to an enum, the value is coerced into the range of the enum. If the range of the enum is 0 to 25, the value is converted to 0.