1.2.4 Data Types

The operations provided by the DSP Library have been designed to take advantage of the DSP instruction set and architectural features of the PIC32A devices. Therefore, most operations are computed using 1.31 fixed-point arithmetic.

The DSP Library defines a fractional type from an integer type:

#ifndef fractional 

     typedef int fractional; 

#endif

The 1.31 fixed-point data are represented with one sign bit and 31 fractional bits, which is commonly known as the 1.31 fixed-point format. The results of functions which use the multiplier are computed using the 72-bit accumulator with 9.63 arithmetic. This format comprises nine sign/magnitude bits and 63 fractional bits, providing space for extra computation beyond the range of -1.00 to approximately +1.00 offered by the 1.31 format. When these functions return a result, they revert to a fractional data type in the 1.31 format.

The use of fractional arithmetic has some constraints on the allowable set of values to be input to a particular function. However, several functions perform implicit scaling to the input data and/or output results, which may decrease the resolution of the output values (when compared to a floating-point implementation).

A subset of operations in the DSP Library, which requires a higher degree of numerical resolution, does operate in floating-point arithmetic. Nevertheless, the results of these operations are transformed into fractional values for integration with the application. The only exception to this is the MatrixInvert function which computes the inversion of a floating-point matrix in floating-point arithmetic and provides the results in a floating-point format.