Version:

Last Modified: September 26, 2017

For the fixed-point data type, 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 image uses 16-bit unsigned fixed-point configuration to show the general notation of fixed-point numbers. The image shows the example configuration as it appears on the **Item** tab when you select a fixed-point terminal or operator on the diagram.

- Specifies the signed value and total number of bits of the fixed-point configuration. U indicates that the configuration is unsigned and I indicates that the configuration is signed.
- Displays the number of bits reserved for the integer length. Adding integer bits increases the maximum value that an unsigned fixed-point number can represent, and increases both the maximum and minimum values that a signed fixed-point number can represent.
- Displays the number of bits reserved for the fractional length. Adding fractional bits increases the precision that the fixed-point number can represent.

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, a smaller place value is assigned to the stored bits in relation to the binary point. For configurations with negative fractional lengths, a larger place value is assigned 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, you must decide when to limit the number of bits you use for your fixed-point numbers based on the size and performance constraints of your design, or due to the 64-bit maximum length of the fixed-point data type. 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 assigned 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 × 2^{1 }+ 0 × 2^{0} + 0 × 2^{-1} + 1 × 2^{-2} |
2.25 |

U4 <4.0> | 0 to 15 | 1 | 1 × 2^{3} + 0 × 2^{2} + 0 × 2^{1} + 1 × 2^{0} |
9 |

I4 <2.2> | -2 to 1.75 | 0.25 | 1 × (-2^{1}) + 0 × 2^{0} + 0 × 2^{-1} + 1 × 2^{-2} |
-1.75 |

U4 <5.-1> | 0 to 30 | 2 | 1 × 2^{4} + 0 × 2^{3} + 0 × 2^{2} + 1 × 2^{1} |
18 |

U4 <-1.5> | 0 to 0.46875 | 0.03125 | 1 × 2^{-2} + 0 × 2^{-3} + 0 × 2^{-4} + 1 × 2^{-5} |
0.28125 |