Multiplication And Division Functions; 32-Bit Multiplication; 32-Bit Division; Conversion Functions - National Instruments AutoCode NI MATRIX Reference

National instruments ni matrixx reference manual
Table of Contents

Advertisement

Multiplication and Division Functions

Computation of 32-bit values is compiler vendor dependent. Results compared
Note
against the equivalent floating-point computation can vary significantly. The only solution
is to upgrade to a version of an Ada compiler that implements more robust fixed-point
numerics.

Conversion Functions

© National Instruments Corporation
The predefined multiplication and division operators for fixed-point type
based arguments are defined in Ada for any combination of fixed-point
arguments. The result of the computation is exact and of arbitrary accuracy.
Thus, a conversion to the result type of the expression must be performed.
During this conversion, accuracy might be lost. The implementation of the
generic functions that perform multiplication and division use the
predefined operators and perform the conversion to the result type.

32-Bit Multiplication

Multiplication of two 32-bit fixed-point numbers might not necessarily be
exact. The problem is that the predefined operator is sometimes unable to
use an extended 64-bit calculation to perform the operation. Thus, the result
might not be exact. As a rule of thumb, if the sum of the radices of the types
of the operands is less than 31, the result should be exact. If that sum is
larger than 31, loss of precision might occur.

32-Bit Division

Division of two 32-bit fixed-point numbers might not be exact. The
problem is that the predefined operator is sometimes unable to use an
extended 64-bit calculation to perform the operation. Thus, the result might
not be exact. As a rule of thumb, if the radix of the type of the denominator
is less than 16, the result should be exact; otherwise, loss of precision might
occur.
Values from one data type (fixed-point or other type) might need to be
converted to another data type (fixed-point or other type). For any
conversion of a value that has type of lesser accuracy to a type with a
greater accuracy, loss of precision will not occur, but overflow is possible.
For example, a value represented in
will not lose accuracy, unless the value overflows.
RT_SSHORT03
However, when converting a value that has a type of greater accuracy to
a type that has a lesser accuracy, loss of precision will occur, but there is
Chapter 3
RT_SSHORT01
3-31
Ada Language Reference
converted to
AutoCode Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AutoCode NI MATRIX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Autocode ni matrixx

Table of Contents