Chapter 3 Ada Language Reference
AutoCode Reference 3-20 ni.com
System-Level Parameters to Generate User Types
Table 3-6 describes new system-level parameters that are used to generate
the USER_TYPES package.
Overflow Protection
Overflow is defined as loss of significance—that is, a computation
resulting in a value that cannot be represented in the range of a specific
fixed-point type. Overflow refers to a value larger than the largest number
in the type range, and underflow refers to a value smaller than the smallest
number in the type range.
For the standard Ada fixed-point types, if an overflow occurs, an exception
is raised. AutoCode/Ada provides the capability to detect and correct an
overflow condition in a fixed-point computation. This is accomplished
within the implementations of the generic functions in the
SA_FIXED_GENERICS package.
The implementation provided for each of the generic functions uses
exception handlers to detect when an overflow occurs. Correction is
performed by examining the values of the function and replacing the
overflowed value with the extreme value for the data type; the largest
number if an overflow, the smallest number if an underflow.
The reliance upon exceptions to detect overflow conditions can be
computationally expensive as it may require a significant number of
machine instructions to handle the exception. As a result, execution times
can suffer. However, if a particular data type used in a calculation is
Table 3-6. System-Level Parameters to Generate User Types
Name Description
n_user_defined_type_i The number of user types in the current
model.
usertype_name_ls An array of strings that contain the
names of all of the user types in the
model. Array size is
n_user_defined_type_i.
usertype_basename_ls An array of strings that contain the
names of all the base types of the user
types of the model. Array size is
n_user_defined_type_i.