Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатика
ИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханика
ОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторика
СоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансы
ХимияЧерчениеЭкологияЭкономикаЭлектроника

Transfer procedures

Читайте также:
  1. Admission procedures
  2. File handling procedures
  3. PROCEDURES FOR SUBMITTING AN ENTRY TO DV-2003

In the statement pack(a,i,z) and in the statement unpack(z,a,i) the following shall hold: a and z shall be variable-accesses; a shall possess an array-type not designated packed; z shall possess an array-type designated packed; the component-types of the types of a and z shall be the same; and the value of the expression i shall be assignment-compatible with the index-type of the type of a.

Let j and k denote auxiliary variables that the program does not otherwise contain and that have the type that is the index-type of the type of z and a, respectively. Let u and v denote the smallest and largest values of the index-type of the type of z. Each of the statements pack(a,i,z) and unpack(z,a,i) shall establish references to the variables denoted by a and z for the remaining execution of the statements; let aa and zz, respectively, denote the referenced variables within the following sentence. Then the statement pack(a,i,z) shall be equivalent to

begin

k:= i;

for j:= u to v do

begin

zz[j]:= aa[k];

if j <> v then k:= succ(k)

end

end

and the statement unpack(z,a,i) shall be equivalent to

begin

k:= i;

for j:= u to v do

begin

aa[k]:= zz[j];

if j <> v then k:= succ(k)

end

end

 

NOTE --- Errors will arise if the references cannot be established, if one or more of the values attributed to j is not assignment-compatible with the index-type of the type of a, or if an evaluated array component is undefined.

 

Required functions

 

General

The required functions shall be arithmetic functions, transfer functions, ordinal functions, and Boolean functions.

 

Arithmetic functions

For the following arithmetic functions, the expression x shall be either of real-type or integer-type. For the functions abs and sqr, the type of the result shall be the same as the type of the parameter, x. For the remaining arithmetic functions, the result shall always be of real-type. The result shall be as shown in table 2.

 

Table 2 --- Arithmetic function results

FunctionResult

abs(x) absolute value of x

sqr(x) square of x

It shall be an error if such a value does not exist.

sin(x) sine of x, where x is in radians

cos(x) cosine of x, where x is in radians

exp(x) base of natural logarithms raised to the power x

ln(x) natural logarithm of x, if x is greater than zero

It shall be an error if x is not greater than zero.

sqrt(x) non-negative square root of x, if x is not negative

It shall be an error if x is negative.

`arctan(x) principal value, in radians, of the arctangent of x

 

Transfer functions

 

trunc(x)

From the expression x that shall be of real-type, this function shall return a result of integer-type. The value of trunc(x) shall be such that if x is positive or zero, then 0£x-trunc(x)<1; otherwise, -1<x-trunc(x)£0. It shall be an error if such a value does not exist.

Examples:

trunc(3.5) {yields 3}

trunc(-3.5) {yields -3}

 

round(x)

From the expression x that shall be of real-type, this function shall return a result of integer-type. If x is positive or zero, round(x) shall be equivalent to trunc(x+0.5); otherwise, round(x) shall be equivalent to trunc(x-0.5). It shall be error if such a value does not exist.

Examples:

round(3.5) {yields 4}

round(-3.5) {yields -4}

 


Дата добавления: 2015-11-26; просмотров: 71 | Нарушение авторских прав



mybiblioteka.su - 2015-2024 год. (0.008 сек.)