National Instruments AutoCode NI MATRIX Reference page 92

National instruments ni matrixx reference manual
Table of Contents

Advertisement

Chapter 3
Ada Language Reference
Example 3-4
Word Size Extended Intermediate Type Subtraction Example
Example 3-5
Result Type As Intermediate Type Subtraction Example
Note
The type that is to be used as the intermediate type is represented as a formal
parameter to the addition and subtraction generic functions. There is no requirement that
the implementation of the function use the intermediate type in the calculation of the result.
However, the default implementations do use the intermediate type.
AutoCode Reference
The selection of the intermediate type is performed by the code generator.
The selection involves a set of rules that rely upon word size extension.
Word size extension is selecting a fixed-point type with a larger number of
bits that can be used to represent model numbers. Also, the radix of the
intermediate type is chosen to be the radix of the result fixed-point type.
For all combinations of all the
types, word size extension is possible. However, if any of
RT_USHORT
the
or
RT_SLONG
RT_ULONG
operands, word size extension is not possible because there are no 64-bit
fixed-point types. Example 3-4 and Example 3-5 illustrate that accuracy is
maximized when a word-sized extended intermediate type is used in the
calculation.
Given: n1 is an
RT_SBYTE04
.
RT_SBYTE07
n1 = 1.0625, n2 = 1.0, perform n3 = n1 – n2.
Select intermediate type of
type resulting in n1a = 1.0625 and n2a = 1.0.
Perform t = n1a – n2a = 0.0625.
Assign n3 = t, performing a conversion from
resulting in n3 = 0.0625
RT_SBYTE07
Given: n1 is an
RT_SBYTE04
.
RT_SBYTE07
n1 = 1.0625, n2 = 1.0, perform n3 = n1 – 0n2.
Convert n1 and n2 to the type of n3,
n1(1.0625) and n2(1.0) are not model numbers of the
type, thus both overflow when converted. The largest model number
is substituted so that n1a = 0.9921875 and n2a = 0.9921875.
Perform n3 = n1a – n2a = 0.0
,
RT_SBYTE
RT_UBYTE
fixed-point types is one of the operator's
, n2 is an
RT_SBYTE05
and convert n1 and n2 to that
RT_SSHORT07
, n2 is an
RT_SBYTE05
RT_SBYTE07
3-30
,
RT_SSHORT
and n3 is an
to
RT_SSHORT07
and n3 is an
. Both values of
RT_SBYTE07
and
ni.com

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