In LabVIEW, you define the position of the binary point in relation to the bits stored for a fixed-point number by specifying the number of integer places, called the integer length, and the number of fractional places, called the fractional length, of the configuration.
The following images use the same 8-bit unsigned fixed-point example configuration to show the general notation of fixed-point numbers in LabVIEW. The image on the left shows the example configuration as it appears on the Configure tab when you select a fixed-point terminal or operator on the diagram. The image on the right shows the same configuration as it appears in the Fixed-Point Configurator when you select Modify FXP Configuration from the Data Type drop-down on the Configure tab.
The sum of the integer and fractional lengths in a fixed-point configuration always equals the total number of bits of the configuration. You can configure fixed-point numbers in any combination of integer and fractional lengths up to 64 total bits. For configurations with negative integer lengths, LabVIEW assigns a smaller place value to the stored bits in relation to the binary point. For configurations with negative fractional lengths, LabVIEW assigns a larger place value to the stored bits in relation to the binary point.
You can add bits to the integer and fractional lengths of your fixed-point configurations to increase the range and precision that your configurations can represent. However, when you configure your fixed-point code in LabVIEW, you must decide when to limit the number of bits you use for your fixed-point numbers based on the size and performance constrains of your design, or due to the 64-bit maximum length of the fixed-point data type in LabVIEW. When you encounter a bit-length constraint, you have to decide what range of numbers you need to represent within that limited number of bits. Because the signed value and position of the binary point in a fixed-point configuration determines the numeric value encoded by a set of bits, you can represent a variety of numeric values using the same limited number of total bits by manipulating the integer and fractional lengths of a fixed-point number.
When you can no longer add bits to your fixed-point configuration but still need to adjust the values that your configuration can represent, you must decide to increase the number of bits in one part of your configuration and decrease the number of bits in the other part. You either increase the precision, or delta, of your number and decrease the range, or you increase the range and reduce the precision. The following examples use an arbitrary 4-bit limitation to demonstrate that you can alter the representable numeric range of a limited set of bits by manipulating the integer and fractional lengths of a fixed-point number. The Value of Example Binary Input 1001 column in the table shows the place values that LabVIEW assigns to each stored bit in the example input, based on the configuration. The Decimal Value of Example Input column shows the computed decimal values of the example input based on the fixed-point configuration.
|FXP Configuration||Range||Delta||Value of Example Binary Input 1001||Decimal Value of Example Input|
|U4 <2.2>||0 to 3.75||0.25||1 × 21 + 0 × 20 + 0 × 2-1 + 1 × 2-2||2.25|
|U4 <4.0>||0 to 15||1||1 × 23 + 0 × 22 + 0 × 21 + 1 × 20||9|
|I4 <2.2>||-2 to 1.75||0.25||1 × (-21) + 0 × 20 + 0 × 2-1 + 1 × 2-2||-1.75|
|U4 <5.-1>||0 to 30||2||1 × 24 + 0 × 23 + 0 × 22 + 1 × 21||18|
|U4 <-1.5>||0 to 0.46875||0.03125||1 × 2-2 + 0 × 2-3 + 0 × 2-4 + 1 × 2-5||0.28125|