Addition And Subtraction Functions - National Instruments AutoCode NI MATRIX Reference

National instruments ni matrixx reference manual
Table of Contents

Advertisement

function ">=" is new SA_FIXED_GENERICS.GREATEREQUAL(SA_FIXED.RT_SSHORT14,
--pragma inline (">=");
function ">=" (LEFT, RIGHT : SA_FIXED.RT_SSHORT13) return BOOLEAN
--pragma inline (">=");
function RT_US11 is new
SA_FIXED_GENERICS.FLOATFIXEDCAST(SA_FIXED.RT_USHORT11);
--pragma inline (RT_US11);
-- Conversion Function Instantiations --
function RT_US13r is new
SA_FIXED_GENERICS.FLOATFIXEDCAST_ROUND(SA_FIXED.RT_USHORT13);
--pragma inline (RT_US13r);
function RT_SS12_It is new
SA_FIXED_GENERICS.INTCAST_TRUNC(SA_FIXED.RT_SSHORT12);
--pragma inline (RT_SS12_It);
end RT_FIXED_OPERATORS;

Addition and Subtraction Functions

© National Instruments Corporation
The
and
FIXED_ADD
and subtraction of fixed-point types. Unlike the predefined Ada fixed-point
operators, these generics support mixed-type operators, that is, the types of
the operands do not have to be the same. To achieve results as accurate as
possible without introducing overflow requires the use of an intermediate
type in the calculation. The intermediate type is chosen such that the
following properties are maintained: the values of each operand do not
overflow when converted to the intermediate type; the result of the
operation does not overflow when represented in the intermediate type.
If such an intermediate type can be found for the two operands of the
operation, the result is guaranteed to be exact. Therefore, addition and
subtraction uses the intermediate type for the calculation of the result such
that the operations are defined as:
c = a + b ==> c = RESULT_TYPE( IT(a) + IT(b) )
c = a - b ==> c = RESULT_TYPE( IT(a) - IT(b) )
The two operands are converted to the intermediate type (IT), and then
the operation is performed. Then, the result is converted to the result type
(
). Loss of significance can occur when converting to the
RESULT_TYPE
result type.
generic functions implement addition
FIXED_SUB
3-29
Chapter 3
Ada Language Reference
SA_FIXED.RT_SSHORT08);
renames SA_FIXED.">=";
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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Autocode ni matrixx

Table of Contents