In digital hardware, numbers are stored in binary words. A binary word is a fixed-length sequence of binary digits (1's and 0's). The way in which hardware components or software functions interpret this sequence of 1's and 0's is described by a data type.
Binary numbers are represented as either fixed-point or floating-point data types. A fixed-point data type is characterized by the word size in bits, the binary point, and whether it is signed or unsigned. The binary point is the means by which fixed-point values are scaled. With the Fixed-Point Designer™ software, fixed-point data types can be integers, fractionals, or generalized fixed-point numbers. The main difference between these data types is their default binary point.
Floating-point data types are characterized by a sign bit, a fraction (or mantissa) field, and an exponent field. Fixed-Point Designer adheres to the IEEE® Standard 754-1985 for Binary Floating-Point Arithmetic (referred to simply as the IEEE Standard 754 throughout this guide) and supports singles and doubles.
When choosing a data type, you must consider these factors:
The numerical range of the result
The precision required of the result
The associated quantization error (i.e., the rounding mode)
The method for dealing with exceptional arithmetic conditions
These choices depend on your specific application, the computer architecture used, and the cost of development, among others.
With the Fixed-Point Designer software, you can explore the relationship between data types, range, precision, and quantization error in the modeling of dynamic digital systems. With the Simulink® Coder™ product, you can generate production code based on that model. With HDL Coder™, you can generate portable, synthesizable VHDL and Verilog code from Simulink models and Stateflow® charts.