Information technology - Programming languages - Generic packages of real and complex type declarations and basic operations for Ada (including vector and matrix types)

Technologies de l'information — Langages de programmation — Paquetages génériques de déclarations de types réel et complexe et opérations de base pour Ada (y compris les types vecteur et matrice)

General Information

Status
Withdrawn
Publication Date
26-Aug-1998
Withdrawal Date
26-Aug-1998
Current Stage
9599 - Withdrawal of International Standard
Start Date
12-Aug-2010
Completion Date
30-Oct-2025
Ref Project
Standard
ISO/IEC 13813:1998 - Information technology -- Programming languages -- Generic packages of real and complex type declarations and basic operations for Ada (including vector and matrix types)
English language
62 pages
sale 15% off
Preview
sale 15% off
Preview

Frequently Asked Questions

ISO/IEC 13813:1998 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology - Programming languages - Generic packages of real and complex type declarations and basic operations for Ada (including vector and matrix types)". This standard covers: Information technology - Programming languages - Generic packages of real and complex type declarations and basic operations for Ada (including vector and matrix types)

Information technology - Programming languages - Generic packages of real and complex type declarations and basic operations for Ada (including vector and matrix types)

ISO/IEC 13813:1998 is classified under the following ICS (International Classification for Standards) categories: 35.060 - Languages used in information technology. The ICS classification helps identify the subject area and facilitates finding related standards.

You can purchase ISO/IEC 13813:1998 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of ISO standards.

Standards Content (Sample)


INTERNATIONAL ISOAEC
STANDARD 13813
First edition
1998-08-0 1
Information technology - Programming
languages - Generic packages of real and
complex type declarations and basic
operations for Ada (including vector and
matrix types)
Technologies de I’in forma tion - Langages de programmation -
Paquetages g&Griques de dkclarations de types r6el et complexe et
opkrations de base pour Ada (y compris les types vecteur et matrice)

Contents Page
............................................. V
Foreword
Introduction vi
..........................................
1 Scope . 1
2 Normative referenccs
.................................
3 Types and operations provided 2
.........................
.
4 Instantiations
......................................
5 Implementations 3
....................................
6 Exceptions 4
........................................
7 Arguments outside thc rangt of safe numl~ers 5
...............
8 Method of spccification of subprograms . 5
9 Accuracy requirements G
...............................
10 Overflow . 7
11 Infinities . 8
12 Underflow . 8
Generic Complex Types Package . 8
.
13.1 Types . 9
.,
13.2 Constants 9
...................................
13.3 COMPLEX selection, convcrsion and cornposition operations 9
COMPLEX arithmetic operations 11
13.4 .
13.5 Mixed REAL and COMPLEX arithmetic opcrations . 12
13.6 Mixed IMAGINARY and COMPLEX arithmetic opcrations . 12
@ ISO/IEC 1998
no part of this publication may be
All rights reserved. Unless ot herwise specified,
reproduced or utilized in any form or by any means, electronie or mechanical, including
photocopying and microfilm, without Permission in writing from the publisher.
ISO/IEC Copyright Office l Case postale 56 l CH-1211 Geneve 20 l Switzerland
Printed in Switzerland
ii
@ ISO/IEC ISO/IEC 13813:1998(E)
13.7 IMAG INARY sclcc t ion, conversion and composi t ion operat ions
13.8 IMAGINARY ordinal and arithmetic: opcrations . . . . . . . . .
13.9 hilixcd REAL and IMAGINARY arithmetic opcrations. . . . . .
14 Array Exceptions Packagc . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
........................... 15
15 Generic: Real Arrays Package
....................................... 15
15.1 Types
.
................ 15
15.2 REALJECTOR arithmetic operations
................... 16
15.3 REALJECTOR scaling operations
.................... 16
15.4 Other REALJECTOR operations
................ 17
15.5 REAL-MATRIX arithrnetic operations
................... 18
15.6 REAL-MATRIX scaling operations
....................
15.7 Other REAL-MATRIX operations 18
16 Gencric Complcx Arrays Packagc . . . . . . . . . . . . . . . . . . . . . . .
.
16.1 Typcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
.
16.2 COMPLEXJECTOR sclcction, convcrsion and composition
opcrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
16.3 COMPLEXJECTOR arithmetic opcrations . . . . . . . . . . . . . . 20
16.4 n/rixcd REALJECTOR and COMPLEXJECTOR arithrnetic op-
crations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
16.5 COMPLEXJECTOR scaling operations . . . . . . . . . . . . . . . . 21
16.6 Other COMPLEXJECTOR operations . . . . . . . . . . . . . . . . . 22
16.7 COMPLEX-MATRIX selcction, convcrsion and composition
opcrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
16.8 COMPLEX-MATRIX arithmcti<: operations . . . . . . . . . . . . . . 23
16.9 Mixed REAL-MATRIX and COMPLEX-MATRIX arithrnetic op-
erations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
16.10 COMPLEX-MATRIX scaling operations . . . . . . . . . . . . . . . .
16.11 Othor COMPLEX-MATRIX operations . . . . . . . . . . . . . . . . .
17 Gcneric Complex Input/Output Packagc . . . . . . . . . . . . . . . . . .
18 Standard non-gcncric: packagcs . . . . . . . . . . . . . . . . . . . . . . . . .
Annexes
A Ada specification for GENERIC-COMPLEX,TYPES. . . . . . . . . . . . . .
B Ada spccification for ARRAY-EXCEPTIONS . . . . . . . . . . . . . . . . . . 33
C Ada spccification for GENERIC-REAL-ARRAYS . . . . . . . . . . . . . . .
D Ada spwification for GENERIC-COMPLEX,ARRAYS . . . . . . . . . . . . .
E Ada spccification for COMPLEX-IO . . . . . . . . . . . . . . . . . . . . . . .
F Rat,ionalc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.l Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2 Introdwtion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.3 What Basic: opcrations arc inc:ludcd ‘! . . . . . . . . . . . . . . .
F.4 Sclccting an arrav indcx siibtypc . . . . . . . . . . . . . . . . . .
.
.
F.5 Tbc usc of ovcrloadings versus default valucs . . . . . . . . . 44
F.6 Shoiild const ants lw incliidcd ‘! . . . . . . . . . . . . . . . . . . . .
F.7 why .
F.8 Tbc * nsc of opcrator not,ation vc1w1s function not,ation . . .
F.9 Complcx arithmctic . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . .
@ ISO/IEC
.......................... 48
F.10 Accuracy requircmcnts
.
................. 49
F.ll Narrling and renarr~irlg <:onverlt,ions
................................... 50
F.12 Genericity
.............................
F.13 Range constraints
...... 5 1
F.14 Exceptional c:ondit,ions, sigmd zeros and inhitics
........................ 51
F.15 The COMPLEX-IO package
t 1lC
F.16 Packaging of mal, cornplcx and rrlixcd opcrations
......................
ok1.j cc t ivcs and conscql mlccs
..........................
F.17 Ada 95 considcrations
G Ada 95 specifications of array packages . . . . . . . . . . . . . . . . . . .
.
H Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv
@ ISO/IEC
Foreword
ISO (the Iuternational Orgariization for Standardization) and IEC (the Iu-
ternational Elcc:trote<:hrli<:al Cornrnission) forrn thc speeialized systern for
worldwide standardizatiori. National bodics that arc rnernbcrs of ISO or IEC
part icipate in t he dcveloprneut of International Standards t hrough technical
cornrnittees cstablishcd by thc respective organization to deal with particular
ficlds of techuical activity. ISO arid IEC technical cornrriittees collaborate
.
iri ficlds of rriut ual ihterest .
0 t her intcrnat ional orgauizat ious, goverurnental
and non-governrncntal, iri liaison with ISO and IEC, also take part in the
work.
In thc ficld of inforrnation technology, ISO and IEC have established a
.
joiut techriical cornrnittcc, ISO/IEC JTC 1. Draft International Standards
.
adopted by the joint techuieal comrnittec are eirculated to national bodics
for voting. Publication as an International Standard requires approval by at
.
least 75 ‘)/o of the national bodies casting a vote.
Intcruatiorial Standard ISO/IEC 13813 was prepared by Joint Technical
Cornrnit tce ISO/IEC JTC 1, ~~,~ommt~on technolo.gy, Subeornrnit tec 22, Pr-o-
qfrarn,rn,in,g lanpages,
their en,vir*on~m,en,ts and systenl software interjaces.
. . . .
Arincxcs A, B, C, D ahd E forrn an integral part of this Intcruational Stan-
dard. Armcxcs F, G and H arc for inforrnation only.

@ ISO/IEC
Introduction
The generic packages described here are intended to provide the basic: x-cal and
cornplex scalar, vector, and rnatrix opcrations frorn which portable, rcusable
applications tan bc built . This International Standard scrves a broad class of
applicat ions wit h reasonablc casc of use, while dcrnanding irnplerncnt at ions
that arc of high quality, capable of Validation and also practical givcn thc
state of the art.
Tbc spccifications included in this International Standard arc prescntcd as
cornpilable Ada spccifications in anncxcs A, 113, C, D and E with explanator,y
tcxt in nurnbercd scctions in t hc rnain body of text . Tbc cxplanat,ory tcxt is
norrnat ivc, wit h the except ion of notes (labelcd as such).
The word “rnay,” 8s iised in t his Intcrrmt ional St andarrl, consistent ly mcans
.
“arc allowed to” ) . It is used only to cxpress permission
5s allowed to” (01
as in t he c:ornrnonly omirrii~g Phrase “an irnplerncnt at ion rnay” ; ot her words
suc 1 as “tan ,” l!could” or i’rrlight:i) arc uscd to cxprcss ability, possibility,
( 1
capacity or conscquent iality.
Vl
INTERNATIONAL STANDARD 0 IWIEC
Information technology -
Programming languages -
Generic packages of real and complex type declarations
and basic operations for Ada (including vector and matrix
1 Scope
This International Standard defines t he spccifications of throc gcneric: packagcs of scalar , vcct or and rnat rix opera#t ions
callcd GENERIC-COMPLEX-TYPES, GENERIC-REAL-ARRAYS and GENERIC-COMPLEX-ARRAYS, thc specification of a packagc
of rclatcd cxceptions callcd ARRAY-EXCEPTIONS arid the spccification of a gcncric: package of complex input and output
opcratNions called COMPLEX-IO. A packagc body is not rcqllircd for ARRAY-EXCEPTIONS; bodies of thc othcr packagcs
arc not providod by this International Standard.
Tbc spcc:ificat,ions of non-gcncric packagcs callcd COMPLEX-TYPES, REAL-ARRAYS and COMPLEX-ARRAYS arc! also ckdkd,
t,ogct her wi t 11 t llosc of amlogous packagcs for ot her prccisions. This International Standard docs not providc thc
bodics of t,llesc packagcs.
This International Star&& specifics ccrtain furldarnental scalar, vcctor and rnatrix aritlmetic operations for real,
irriaginary and complcx ni mbcrs. Tllcy wcrc chosm lmausc of thcir utility in various application areas; rnoreover,
.
t hey arc ~mxkx~ to support, a, gencric: packagc for complex clcrncnt ary funct ions.
This International Standard is applimblc to prograrrming cnvironrnents conforrning to ISO/IEC 8652.
NOTE - This International Standard is specifically designed for applicability in programming environments conforming to
comparable facilities are specified in
ISO/IEC 8652:1987. Except for the packages and generic packages dealing with auays,
ISO/IEC 8652:1995; specifications for t,he generic array packages comforming to ISO/IEC 8652:1995 arc provided in annex G.
2 Normative references
Tbc following standards contain provisions which, through rcfcrcncc in this tcxt, constitutc provisions of this Interna-
tional Standard. At the tirne of publication, the editions indicated were valid. All Standards arc subject to revision,
and Parties to agrcernents based 011 this International Standard arc cncouragcd to invcstigate the possibility of applying
the rnost rccent cditions of the Standards indicatcd below. Mcrnbers of IEC and ISO rnaintain rcgistcrs of currently
valid Ir~tcrnatior~al Standards.
ISO/IEC 8652, fnjowr~,ation tech,noloqTy Proqs~arnrr~krq banguages Ad a.
. . .
. * .
PI.o9~*a7nn2l:lr,g danquages Gen,eCc package oj edementaw~ jwnctions Job
ISO/IEC 11430, Injovrrmtion techm,oloqy
. r . .
Ada.
Programmin, danguages Geneuic package oj pxCrn,itive junctioas Job
ISO/IEC 11729, 1 r/ f o~w~,c~tion tech,nobqg
. .
Ada.
P7.097.a7r27a~ng dangwaqes Genewlc package o j complex edernedam~ jwnc-
ISO/IEC 13814, Jn~olrmation tech,nology~
. .
tious jojr Ada.
3 Types and operations provided
ll~c packagcs prov idcd by t his International
The following rccord type, scalar typc and four arrav tvpcs arc cxportcd by t
. ., .
Standard:
COMPLEX IMAGINARY
REAL-VECTOR REAL-MATRIX
COMPLEX-VECTOR COMPLEX-MATRIX
Type COMPLEX proviclcs a cartcsian reprcsentation of complex scalars; typc IMAGINARY is providctl to rcprescnt pure
. .
irnaginary scala,rs; two cornpositc typcs with clernents of typc: REAL arc providcd, REAL-VECTOR and REAL-MATRIX:
t,o represent real vcctors and matriccs; and two cornposite types with clorrlcnts of typc COMPLEX arc providod, COM-
PLEX-VECTOR arid COMPLEX-MATRIX, to rcprcscnt cornplcx vectors and rnatriccs.
The following twenty-four opcrations arc providcd:
.
II + II It * II 11 II
/
Il < II Il <=II ll > II II >=II
II ** ll
Il abs l1 CONJUGATE TRANSPOSE
RE IM SET-RE SET-IM
COMPOSE-FROM-CARTESIAN MODULUS ARGUMENT COMPOSE-FROM-POLAR
UNIT-VECTOR IDENTITY-MATRIX GET PUT
Thcsc arc the usual rnathernatical Operators (+, -, * and /) for real, corriplcx and irnaginary scalars, and for real
and c:onlplcx vectors and rnat rices (togct her wit h analogous cornponcntwisc opcrations for vcctors) ; t,hc rclat ional
opcrators (<, <=, > and >=) for imaginary scalars; thc cxponcntiation opcrator (**) for cornplcx and irrlaginary scalars,
and for real and cornplcx vectors; thc absolute value opcrator (abs) for mal, irnaginary a,nd cornplcx s(:ala,rs, and for
real and cornplox vcctors and rnatriccs; thc conjugate opcration ( CONXJGATE) for co~nplcx and irnaginary scalars, and
for c:ornplex vectors and rnat rices; t he transpose opcrat,ion (TRANSPOSE) for real and c:ornplcx rnat riccs; t he (:ar tcsian
c:ornponent-part operations (RE, IM, SET-RE, SET-IM and COMPOSE-FROM-CARTESIAN) for c:omplox scalars, vcctors
and matriccs (and, whcre applicable, for irnaginary sc:alars), for solccting cornponcnt-Parts and for corrlposing from
cornponent-Parts; thc polar cornponcnt-part opcrations (MODULUS, ARGUMENT and COMPOSE-FROM-POLAR) for cornplcx
scalars, vectors and rnatriccs, for selccting cornponcnt-Parts and for corrlposing from c:orrlporlcrlt-Parts; thc initializing
opcrations (UNIT-VECTOR and IDENTITY-MATRIX) for real and complcx vcctors and matriccs; and thc input8/output
opcrations (GET and PUT) for c:ornplcx scalars.
4 Instantiations
This International Standard dcscribcs gcncric: packagcs GENERIC-COMPLEX-TYPES, GENERIC-REAL-ARRAYS, GENER-
IC-COMPLEX-ARRAYS and COMPLEX-IO. Esch packagc has a gcncric: formal paramctcr, which is a gcncric: formal
floatingpoint type narned REAL. At instantiation, this pararnctcr detcrrninos the prcc:ision of the arithrnotic:.
.
This International Standard also desuibcs non-gcncric: packagos COMPLEX-TYPES, REAL-ARRAYS and COMPLEX-ARRAYS,
which providc thc sarnc capabilitv as instantiatiorls of thc packagcs GENERIC-COMPLEX-TYPES, GENERIC-REAL-ARRAYS
.
and GENERIC-COMPLEX-ARRAYS. It is rcquircd that non-gcncric: packagcs 1~ c:o~rstruc:totl for cac:h prccision of floating-
Point type defined in packagc STANDARD.
.
Depending 011 thc irnplcrrlolltatioI1, thc uscr rnay or rnav not 1~ allowctl to spcc:ifv a gmcric: ac:tual tvpc having a range
.
umstraint (sec claiisc 5). If allowcd, SUCH a, rangt constraint will havc thc iisml tdh:t of c:ausirig C~NSTRAINT-ERR0R
to be raised whcn a scalar argiiment oiitside thc uscr ’s rarlgc is passet1 in a ca.11 t,o ono of thc siibprograrns, 01’ whm
orie of thc subprograrns attcrripts to return a sc:alar va,luc (or to c:oristriic:t a cornpositc valiic with a sc:alar c:omponcnt
or elemcnt) oiitside thc user ’s range. Allowing thc gmcric: actnal tvpc to havc a rangt: constraint, also has solrlc
.
irnplications for iiriplcrrioiit,crs.
@ ISO/IEC ISO/IEC 13813:1998(E)
5 Implernentations
Portable irriplcrrieritatioiis of GENERIC-COMPLEX,TYPES, GENERIC-REAL-ARRAYS, GENERIC-COMPLEX-ARRAYS and COM-
PLEX-IO arc stronglv enc:omxqx~. Howcvcr, irnplerncrltatiorls arc not required to he portable. In pa8rticular, an
.
implcrnentat ion of this International Standard in Ada rnay use pragrna INTERFACE or ot her pragrnas, unchecked
convcrsion, rnachine-code inscrtions, 01’ othcr rrlac-:hirlc-dcpclldcnt techniques as desired.
An irllpl”~ ““rltatioI~ is allowcd to rnakc reasonablc assumptions about the environrnent in which it, is to be used,
but only when neccssary in ordcr to match algorithrns to hardwarc characteristics in an econornical rnanner. For
.
cxample, an irnplerncntation is allowed to lirnit the precision it supports (by stating an assumed rnaxirnurn value for
SYSTEM . MAX-D IGITS) , sincc portable irriplcrncnt at ions would not ,
in gcncral, bc possible otherwise. All such lirnits
and assurnpt ions shall be clcarly domrncnt cd. B,y convcntion, an irnplcrncntation of GENERIC-COMPLEX-TYPES, GENER-
IC-REAL-ARRAYS, GENERIC-COMPLEX-ARRAYS or COMPLEX-IO is Said not to conforrn to this International Standard in
any cnvironrnent in which its lirnits or assurnptions arc not satisfiod, and this International Standard does not define
it s bchavior in t hat environmcnt .
In cf-fec%, t his convent ion delirnit s t he por t ability of irnplerncnt at ions.
For any ofthe gencric: packagcs GENERIC-COMPLEX-TYPES, GENERIC-REAL-ARRAYS, GENERIC-COMPLEX-ARRAYS or COM-
.
PLEX-IO, an irnplomentation rnay irnposc a rcstriction that thc gcncric actual typc shall not have a range constraint
.
.
that rcduces the rangt of allowablc valucs. If it does irnposc this restriction, then the rcstriction shall be domrnented,
and the cffccts of violating the rcstriction shall be onc of thc following:
Cornpilation of a unit containing an instantiation of that gcncric: packagc is rcjccted.
.
CONSTRAINT-ERROR or PROGRAM-ERROR is raiscd during the elaboration of an instantiation of that generic pack-
atge .
Convcrscly, if an irnplcrncnt at ion docs not irnposc t he restritt ion, then such a range const raint shall not be allowed,
whcn includcd with tho user ’s actual typc, t$o intcrfcrc with thc intcrnal cornputations of the subprograrns; that is, if
thc argumcnts and result (of functions), or thcir <:ornponcnts, arc within the range of the typc, thcn the irnplenientation
shall rcturn thc rcsult (if any) and shall not raisc an cxception (such as CONSTRAINT-ERROR).
.
AIR of thc rcstrictions dismssed abovo rnay in fact be inheritcd frorn irnplcrnentations of thc packagc GENERIC-ELE-
.
MENTARY-FUNCTIONS of ISO/IEC 11430 and thc packagc GENERIC~PRIMITIVE~FUNCTIONS of ISO/IEC 11729, if med.
Tbc dcpordcr~e of an irnplcmcnt at ion on such inhcrited rest rictions should bc domrncntod.
Irnplomcntations of GENERIC-COMPLEX-TYPES, GENERIC-REAL-ARRAYS and GENERIC-COMPLEX,ARRAYS shall function
propcrlv in a t a*sking cnvironment . Apart frorn thc obvious rcstriction that an irnplcrncntation of thcse packagcs shall
.,
avoid dcclaring variables t hat are global t o t hc subprograrns, no spccial const raint s arc imposcd on irnplernentations.
With thc cxception of COMPLEX- IO, nothing in this International Standard rcquircs the use of such global variables.
Eornc hmdwarc and t,hcir accornpanying: Ada irnplernelltat,ions have the capability of representing and discrirninating
Ltwccn positiv&r and ncgativcly signcd Zeros as a Imans (for exarnple) of prescrving thc sign of an infinitcsirnal
.
quantity that has undcrflowcd to zcro. IrrlplcrrleIltat,ioIls of thcsc packages rnay cxploit that capability, when availablc,
I .
so as to cxhibit continuity in tho results of ARGUMENT as ccrtain lirnits are approached. At thc samt time, implorncn-
t ations in which that, capability is unavailablc arc also allowcd. Bccausc a dcfinition of what cornpriscs thc capability
of rcprcscnt ing and dist inguishing signcd zcros is bcyond t hc scope of t bis International Standard, implcrnent at ions
arc allowcd thc frccdorn not to cxploit thc capability, CVCI~ whcn it is availablc. This International Standard does not,
spccify thc sigris that an implcrncntation cxploiting signcd zcros shall give to zcro rcsult,s; it docs, howcvcr, spccify
t,hat an irrlplolrlolltatiorl cxploiting signcd mros shall
yicld a scalar rcsult (or a scalar elcrncnt of a cornpositc rcsult)
.
for ARGUMENT that tlcpc~ds on thc sign of a zcro irnaginarv cornponcnt of a scalar argumcnt (or a corrcsponding scalar
.
clcrncnt of a cornpositc argumcnt). An irnplcrncntation shall cxcrcisc its choice consistontly, cither cxploiting signcd-
zcro bohavior cvcrywhcrc OI- nowhcrc in t hosc packagcs. In addition, an irrlplcrmnta.tion shall docurnent its behavior
with rcspcct, t,o signcd zcros.
111 implcmentations of GENERIC-COMPLEX-TYPES and GENERIC-COMPLEX-ARRAYS, all opcrations involving rnixcd real
and c:ornplex arithmc!tic: a#re rcquircd to construct thc rcsult by using real ajrithrnctic: (instoad of by convcrting real
valucs to c:omplcx va~lucs and thcn using c:ornplcx arithm~tic:). This is to facilitatc conformancc with IEEE arithrnetic:.
@ ISO/IEC
6 Exceptions
Tbc ARGUMENT-ERROR cxc:cption is dcclared in GENERIC-COMPLEX-TYPES and GENERIC-COMPLEX-ARRAYS. This cxcep-
tion is raised by a subprograrn in thesc gcneric par:kagcs whcn thc argurirlirt (s) of thc subprograrn violatc onc or rnore
of the conditions givcn in thc subprograrn ’s dcfinition (SCC cla.usc 8).
NOTE - These conditions arc related only tlo the mathematical definition of the subprogam and arc therefore implement,ation
independent.
The ARRAY-INDEX-ERROR cxc:cption is dcclarcd in GENERIC-REAL-ARRAYS and GENERIC-COMPLEX-ARRAYS. This cxcep-
t ion is raiscd bv a subprograrn in thcsc generic: pa<:kagos when the argurncnt (s) of tlic subprograrn violatc onc or rnorc
.
of the conditions for rnatc:hing elerncnts of arrays (as in prcdefincd equality); that is, for dyadic array operations,
the bounds of the givcn lcft and right array opcrands need not bc equal, but thcir appropriatc vcctor lcngths or row
and/or colurnn lcngths (for rnatrices) shall be equal.
The ARGUMENT-ERROR a,nd ARRAY-INDEX-ERROR cxccptions arc dcclared as rcnarnings of exccptions of the sarne narnc dc-
claredinthe ELEMENTARY-FUNCTIONS-EXCEPTIONS packageofISO/IEC 11430 andinthc ARRAY-EXCEPTIONS pac:kagcof
this International Standard, respccztively. These exceptions distinguish neither betwecn different kinds of argurncrlt cr-
rors or array index errors, nor betwcen diffcrcnt subprograrns. The ARGUMENT-ERROR cxccption docs not distinguish bc-
twcen instantiations of cither GENERIC-COMPLEX-TYPES, GENERIC-COMPLEX-ARRAYS, thc GENERIC-ELEMENTARY-FUNC-
TIONS package of ISO/IE(I 11430 or the GENERIC-COMPLEX-ELEMENTARY-FUNCTIONS pac:kage of ISO/IEC 13814. The
ARRAY-INDEX-ERROR cx(:cption docs not distinguish htwtzn diffmmt. ir~star~tiatior~s of cithcr GENERIC-REAL-ARRAYS
or GENERIC-COMPLEX-ARRAYS.
Besides ARGUMENT-ERROR and ARRAY-INDEX-ERROR, thc onlv cxmptions allowd dming a (:all to a subprograrn in thm(:
.
packagcs arc prcdefincd cxccptions, as follows:
Virtually any prcdcfincd oxccption is possiblc during th cvalimtion of an argunicnt of a subprograrn in thesc
.
packagcs. For cxarnplc, NUMERIC-ERROR, CONSTRAINT-ERROR, or evcn PROGRAM-ERROR could bc raiscd if an argurncnt
has an undcfincd valuc; and, as statcd in clausc 4, if the irr~plerr~cr~tatior~ allows rangt constraints in thc gcnoric:
actual typc, thnn CONSTRAINT-ERROR will bc raiscd whcn thc valuc of an argurr~cnt lies outsidc thc rangt of thc
uscr ’s gcncric: actiial typo. Additionally, STORAGE-ERROR ~odd t>o raiscd, o.g. if ir~sdfkimt storagc is availablc to
perforrn thc call. All thcsc cxccptions arc raiscd bcforct thc body of thc subprograrn is cntorcd and thcrcforc havc
no bearing 0x1 irnplcrr~cnt at ions of t hese packagcs.
For thc subprograrrls in COMPLEX-IO only, any of th cxmptions ch:larcd (1)~ rcrlarning) in TEXT-IO ma-y he
. .
For exarnplc, TEXT-IO. LAYOUT-ERROR will bc raiscd during an output
raised in thc appropriatc c:ir(:llrrlstarl<:es.
Operation to a string if thc @en string is too short to hold thc forrrlattcd output. Additionally, TEXT-IO. DATA-ER-
ROR will bc raised during the evaluation of argurncnts of an input opcration if thc corrlponcnts of thc cornplcx
value obtaincd arc not of thc typc REAL, or, for irnplcrrlcntaJtions of COMPLEX-IO not basctf 0x1 an instantiatiorl of
TEXT-IO . FLOAT-IO, if thc input scqucnce docs not havc thc rcquircd Syntax. Irr~plcrr~or~tations of COMPLEX- IO which
rnake usc of an instantiation of TEXT-IO. FLOAT-IO shall rnakc cvcry attcrrlpt to raisc TEXT-IO .DATA-ERROR in thc
presencc of invalid input sequence synt ax; howcvcr , t his International St andarcl rccognizcs t hc difficulty in handling
all possi ble invalid input scquences for t hesc typcs of irr~plcrr~ent at ions.
- Also, as statcd in c:lausc 4, if thc irnplcrr~cntation allows rangt c:onst raints in thc gcncric: atzt ual typc, thcn
CONSTRAINT-ERROR will bc raiscd whcn a subprograrn in thosc pac:kagcs attcrnpts to rcturn a scalar valuc (or to
construct a cornpositc: value with a scalar cornponcnt or clcrncnt) outsidc thc rangt of thc uscr ’s gcncric: actual typc.
Tbc exccption raiscd for this rcason shall bc propagatcd to thc callcr of thc subprograrn.
Whcncvcr thc argurricnts of a subprograrr~ arc such that a scalar rcsult (or a scalar c:ornponcrit 01’ clcrncnt of
a cornpositc rcsult) pcrrnittcd b,y thc ac:c:urac:y rcquirerrlcnts would cxc:cod REAL t SAFE-LARGE in absolute valuc, as
forrnalized bclow in c:lause 10, an irnplcrncnt at ion rrla\i raisc (and shall thcn propagatc to thc c:allcr) thc cxccption
.
specified by Ada for signaling ovcrflow.
~ ~~~ OIKC cxccution of thc body of a subprograrn has bcgun, an irrlplclrlclltatior~ Inlay propagatc STORAGE-ERKOR to
the caller of thc subprograrrl, but only to Signal thc uricxpcctcd cxhaustiori of storagc. Siiriilarl.y, on(:c cxcc:utioii
of thc body of 8 subprogram has bcgun, an irriplcrricritatioil rnay propagatc PROGRAM-ERROR to thc cakr of th
subprograrn, but only to signal crrors rnadc by thc uscr of tliosc packagcs.
@ ISO/IEC ISO/IEC 13813:1998(E)
No exccption is allowcd during it cal1 to it subprogram in thcsc packagcs except thosc permitted by the foregoing rules.
In par-ticular, fm argurncnts for which all scalar results (or scalar cornponents or elernents of all cornposite results)
satisfying the accuracy rcquircrncnts rcrnain less than or cqual to REAL’ SAFE-LARGE in absolute value, a subprograrn
shall locally handle an ovcrflow occurring during thc computation of an interrnediate rcsult, if such an Overflow is
possiblc, and not propagatc an cxception signaling that Overflow to the caller of the subprograrn.
Tbc orllv cxceptions allowed during an instantiation of GENERIC-COMPLEX-TYPES, GENERIC-REAL-ARRAYS, GENER-
.
IC-COMPLEX-ARRAYS or COMPLEX-IO, including the exccution of thc optional scquence of staternents in the body
.
of thc instancc, arc3 CONSTRAINT-ERROR, PROGRAM-ERROR and STORAGE-ERROR, and then only for the following rcasons.
Tbc raising of CONSTRAINT-ERROR during instantiation is only allowed when the irnplernentation irnposes the restriction
.
that thc gcneric actual typc shall not havti a rangt constraint, and the user violates that rcstriction (it rnay, in fact, be
an incscapablc consequencc of thc Violation). Tbc raising of PROGRAM-ERROR during instantiation is only allowed for
for example, Violation of this sarnc restriction, or of other lirnitations
t he purpose of signaling crrors rnadc by thc uscr
of the irnplemcntation. Tbc raising of STORAGE-ERROR during instantiation is only allowed for the purpose of signaling
thc exhaustion of storagc.
NOTE - In ISO/IEC 8652:1987, the exception specified for signaling Overflow 01’ division by zero is NUMERIC-ERROR, but
ISO/IEC 8652:1995 ieplaces that by CONSTRAINT,ERROR.
7 Arguments outside the range of safe numbers
ISO/IEC $3652 fails to ddk~c thc rcsult safc intcrval of any basic or prcdofincd Operation of a real subtype whcn the
. .
absolute valuc of onc of its opcrands cxcccds thc largcst safc nurnbcr of thc Operand subtypc. (Tbc failure to define a
rcsult, in this mse occurs bccausc no safc intcrval is dcfincd for tho opcrand in qucstion.) In ordcr to avoid irnposing
rcquircrncnts that would, conscqucntly, bc morc stringent than thosc of Ada itself, this International Standard likewise
docs not dcfinc thc rcsult of a containcd subprograrn whcn thc absolute valuc of onc of its scalar argurnents (or one of thc
scalar cornponcnt s or clerncnt s of cornpositc argurncnt,s) excccds REAL ’ SAFE-LARGE. All of t he accuracy requircrnent s
and othcr provisions of thc following clauscs arc undcrstood to bc implicitly qualified by thc assumption that scalar
su t )prograrn arg1 urmit s (or scalar cornponcnt s or clcmmt s of cornposit c su bprograrn argumcnts) are less t han or equal
to REAL ’ SAFE-LARGE in absolute valuc.
8 Method of specification of subprograms
Yornc of thc subprograrns havc two or rnorc ovcrloadcd forrns. For cach forrn of a subprograrn covered by this Interna-
Lional Standard, thi subprograrn is spccified by its pararncter and result typc Profile, thc dornain of its &gmmlt(s) if
.
rcstrictcd, its rangt if rcstrictcd, and thc accuracy roquircd of its irnplcrncntation. T he rneaning of, and convent ions
applicat )lc t o, t hc dornsin, rangt and accuracy spccificat ions arc dcscribcd bclow .
Tbc spccification of cach subprograrn covcred by this International Standard includes, wherc neccssary, a character-
ization of t hc argumcnt values for which t he su 1: jprograrn is rnat hernat ically defincd. It is expressed by inequalities
or othcr conditions whicli t hc argumcnts shall satisfy to bc valid. Whcnevcr thc argurnents fail to satisfy all the
contlitions, thc irnpl~rncrltatiorl shall raisc ARGUMENT-ERROR. It shall not raise that exccption if all the conditions arc
satisficd.
Inabilitv to dcliver a rcsult for valid argiirncnts bccausc thc scalar rcsult (or a scalar cornponcnt or elemcnt of thc
.
cornpositc rcsult) ovcrflows, for cxamplc, shall not raise ARGUMENT-ERROR, but shall bc trcatcd in thc sarnc way that
Ada dcfincs for its prcdcfincd float ing-Point opcrat ions (sec clause 10).
Tbc usual rnat hcmatical mcaning of t hc “rangt? of a function is thc sct of valucs into which the function rnaps thc
valucs in its domain. Same of thc subprograrns ~ovoretl by this Intcrnat,ional Standard (for cxample, ARGUMENT) arc
niatl~crriat,it:ally rr~ultivalucd, in thc scnsc that a givcn argurricnt valuc tan bc mappcd b-y the subprograrn into rnan.y
different rcsult, valucs. By mcans of rangt rcstrictions, this International Stardarcl irriposcs a uniqucnc:ss rcquircrncnt
011 tlio rcsults of mdtivaliwcl fimctions, tliord~y rcc-hing tlicrri to singlc-valiictl fiiiictions.
Tlx rangt of ca& sut)program rosult is shown, whcII~o Ixccssary, in tlie spcdications. Range dcfini t ions takc t hc forrn
siibprogram. of thc rang: when
of iricqualitics limiting thc rosdts of a An implcmentat ion Aal1 not, cxt:ccti a limit
that bit is a s& nurribcr of REAL (likc 0.0, 1 . 0, or CYCLE/2 -0 for certain valucs of CYCLE). On tho other hand, whcn
a range lirnit is not a Saft! nurnbci of REAL (likc n, or CYCLE/2 . 0 for ccrtain othcr valucs of CYCLE), an implcrncntation
rnay excecd tht! rang: lirnit, but rnay not cxcccd thc safe mmher of REAL ricxt bcyond thc rangt limit in thc dircction
awa.y from t he intcrior of the rangt; this is, in gcncral, thc best that tan bc expcctetl frorri a port ab10 implmimt ation.
Effectivelv, thercfore. rangt definitions havc thc added effect of irnposing ac:c:urac:y rcquircuicnts 011 implorncutations
above and beyond t hose prescntcd as crror bounds in thc specifications (SW c:laus;: 9).
9 Accuracy requirements
Because thev arc irnplcrncntcd on digital computcrs with only finite precision, thc subprograrns providcd in thcsc
.
generic packages tan, at bcst , 0111~ approxirnatc t hc corrosponding rnathcmat ically dcfincd opcrations.
., .
The accuracy rcquircmcnt s cont ained in t his International Standard dcfine t hc lat it 1 idc t hat implcuicint at ions arc
allowcd in approximat ing t hc intcnded prccisc rnat hcmat ical rcsul t wi t 11 float ing- Point corripu t at ions. Acmracy rc-
quircrncnts of two kintls arc statcd in t hc spcc:ific:ations. Additionally, rang: dofinitions irnposc rcquircrncnts that
constrain t hc valucs irriplcuiint at ions rnay yicld, so t hc rangt dofinit ions arc ariot her soiircc of accuracy rcquirerncnts
(in that context, thc prccisc nicaning of a rangt lirriit t1la.t is not a safc numbcr of REAL, as an accuracy roquirmmlt,
is discmsed in clausc 8). Every . rcsult rcturnod by a subprograrn is sub jcc:t to all of the subprogram ’s applicablc
.
accuracy rcquircmcnts, cxc:cpt in t hc onc c:asc dosc:ribcd in (:lausc 12. In that casc, thc sc:alar result (or scalar corripo-
rients or olcrneuts of thc c:ornpositc rcsiilt) will satisfy a srnall absolute crror roquircmont in liou of thc othcr ac:c:urac:,y
requiremcnts defincd for t he subprograrn.
Tbc accuracy rcquircmcnts 011 array opcrations arc dcfhtd in tcrms of corrcsponding acc:urac:y rcquircrncnts 011 thoir
. . .
(real or corriplcx) sc:alar clcrncnts, mloss the rnatherriatic:al dcfinition of thc opcration in~:lutlos an inncr product
(indicated in the spcc:ific:ations as such). Tbc ac:c:urac:y of operations involving inncr protluc:ts is t>cyontl thc scopc of this
.
International Standard, cxcept that an iiripleirieritatioii shall domrncnt what, if any, oxtclldotl-p~cc:isioI~ ac:c:umulation
of interrnediate rcsults is usetl to irnplemcnt such inner prodiicts.
Tbc first kind of (scalar) ac:c:urac:y rcquirorncnt uscd in thc spocifications is a “maximiui rclativo error rcquiromont .”
.
It is spccificd by bounds ou appropriato nicasurcs of thc rclativo crror in tho r:omputcd rcsult of a subprogram, whi(:h
shall hold (excipt as providcd b-y thc rulcs in clausos 10 and 12) f 01’ all argumcmts sat isfying thc coiidit ions iii t hc
dornain clefini t ion, whcncvcr t hosc uieasurcs arc dofincd.
Three forrns of rncasure arc used in thc spcc:ific:atious; thcy dopcntl 011 thc typc (mal, irnaginary or corriplex) of
. .
.
t he scalar result . In the real or irnaginary casc, the mcasurc is thc usual %la~tivc crror” ; in tlic cmriplcx casc, thc
rneasurc used for ca& component-part is, whcncvcr possiblc, a, ‘!~~oIrlpoIlcIlt-par.t crror,” bit in cases whcrc sihstaSntial
cancellation rr1a.y bc involvcd this is relaxcd to a %ox crror .”
For a real result, if the rnathcrnatic:al rcsult is 0 aud tho c:ornputod rcsult is n:, t heri tlic rolativc orror rel-err (X) is
dcfined in the iisual way:
rel-err(x) = 10 - 2Tl/lCY~
provided the rnathernati<:al result is finite and I~~Ixz~I~~.
For a cornplcx rcsult, if thc mathctrnatical rcsult is (1 + i/j and thc (:oulputcd rcsult is .1: + Q, thcn thc corriponcnt-part
errors renLc:omp-err (3)) 1,,rr,,ng_colrr~,p_elrr (Tl) arc dcfincd as:
real_colrn.p_err(z) = 10 - xi/lui
providcd t he rnat hcrriat ical componcnt -Part (1 is finit c and nonzcro, and
2~rr,~,.~-c:olrr,.p_err (7-j) = IB - ;iy 1 / 1 /j 1
provided t he rriat hornat ical c:orrlpoIlc ’rlt-pa1.t ,O is finit c and r~~~zoro; and tho box CITOI~S redboxxrr (iT),
imag-bo.x-err ( jy) arc dcfirlctl as:
real-box-err(n:) = 1 0 - n:l/ ma,x(juI, I/jl)
%,rr-,n,.~-bon:-err(I/) = l/j - VI/ inax( /01, I[-li)
@ ISO/IEC ISO/IEC 13813:1998(E)
providcd thc rnathcrnatic:al (:orrlporicrit-Parts 0, /j arc finitf: and not both zcro.
In all ot her cascs, thc abovc rneasiires of t he relative crror arc not defined (i.c., whc11 thc rnathciriatical resiilt , or a
or zcro).
componrmt-part of thc rnathcrnatic:al resiilt, is infinite
Tbc sc(:o~Id kind of (scalar) ac:c:urazcy rcquircmcnt uscd in thc specifications is a stipulation, , iisiial1.y in the forrri of an
cqiiality, that thc irriplernc?iitatioii shall tlolivcr “prcscribcd rcsillts” for ccrtain spccial argurncnts. It is used for two
purposcs:
result whc11 onc of thc rricas
t 0 rcsii 1p011e11 t-part of the rnat hcmat ical
rnathcrnat ical , or a c01r resiil t ) is Zero; and
lt (
to strcngthcn thc acciiracy rcquircrncnts at special argiirncnt valiies.
Whrm such a prcsuibcd rcsnlt (or cornponcnt-part of a prcscribod rcsult) is a safc nurnber of REAL (likc 0.0, 1 . 0
or CYCLE/2 . 0 for certain valucs of CYCLE), an implerncntation shall deliver that value. On thc othcr band, whi a
prcscribcd rcsult (or cornponcnt-part of a prcscribcd rcsult) is not a safc number of REAL (likc 7r, or CYCLE/2 . 0 for
ccrtain othcr valucs of CYCLE), an irllplcIrlcrltatiorI rnay dclivcr any valuc in thc surrounding safc interval. Prcscribed
rcsults takc prcrmlcncc ovcr ma~ximurrl relative crror rcqnircrncnts but ncvcr contravcnc thern. Cornplex results need
11ot havc tho samt kind of aumac:.v roquircmmt for both of thcir c:omponcnt-Parts. Whorc all rcsults of an Operation
arc prcsc:ribctl, thc opcrat ion is spccifitd as “cxact .”
Range dcfinitions in thc spocifications, arc an additional sourcc of accuracy requirernents, as stated in clause 8. As an
.
acmracy rcquircmcnt, a rangt dcfinition has the cffcct of climinating some of thc values perrnitted by the maxirnurn
relative crror rcqiiircrncnts, cg. thosc oiitside thc range.
10 Overflow
Floating-Point hardwa.rc: is tvpically inmpablc of rcprcsent ing niimbers
whosc absolute value exceeds sorne
.
i~r~pl~~rr~c~~tatio~~-~l~~~~~~~~l maximim. Fc.k thc typc REAL, that maximm will bc at lmst REAL ' SAFE-LARGE. For the sub-
prograIns defir~cd by t his International Standard, whcncvcr t hc rnaxiniiim rclat ive error rcquirernents permit 8 scalar
rosult (or a scalar &nponmt or clcmcnt of a compositc rcsult) whosc absolute valuc is grcater than REAL ' SAFE-LARGE,
thc iIrlpl~?Irl~rltatioI~ may
yiold an-y rcsiilt pcrmittod 1,. tho maximim relative crror rcqiiircments, 01
raisc thc cxccption spccificd 1,~ Ada for signaling ovcrflow.
111 addit ion, some of t hc fiinctions arc allowcd to Signal ovcrflow for ccrt ain argiirricnt s for which ncit her cornponcnt
of thc rcsiilt tan ovcrflow. This frccdom is grantcd for opcrations involving 4.ther an inner product or cornplex
c~xporlcIltia~,ioIi. Pcrrnission to Signal overflow in thcsc cascs rccognizcs tho diffimlty of avoiding ovcrflow in the
.
corriputation of intcrmcdiatc rcsiilts, givcn thc mrrcnt statt of tho art.
NOTES
1 The Kule permit ’s an implementat,ion tlo raise an except ’ion, instead of delivering a result, for arguments for which t,he math-
ematical result (or a component-Part, of t,he mathematlical result,) is close to but, does not’ exceed REAL' SAFE-LARGE in absolute
value. Such argument,s must necessarily be very close to an argument) for which t,he mathematical result, (or a component-Part’
of t!he mat ’hematical result) does exceed REAL ' SAFE-LARGE in absolute value. In general, this is the best that tan be expected
from a poitable implementlation with a reasonable amount) of effok
2 The rule is motivated by the behavior prescribed by ISO/IEC 8652 for the predefined operations- That is, when the set of
possible resulk of a predefined operat(ion includes a number whose absolute value exceeds the implement)ation-defined maximum,
t,he implement3atsion is allowed t#o raise the except ’ion specified for signaling overflow instead of delivering a result,.
3 In ISO/IEC 8652:1987, t,he exception specified for signaling Overflow is NUMERIC-ERROR, but ISO/IEC 8652:1995 replaces
that by CONSTRAINT-ERROR.
@ ISO/IEC
11 Infinities
An irr~plerrm~tatio~~ shall raisc thc cxr:cptNion specificd by Ada for signaling division by zero in the following spccific’
cascs wherc thc r:orrcspontling mathcmatic:al rcsults, or corriponmt-Parts thercof, arc infinite:
division by (mal, irnaginary or cornplex) zcro;
array opcrations whosc rnathcmatical dcfinition involvcs division of an clcmcnt by (real or cornplcx) zcro;
c)
exponentiation of (real, irnaginary or cornplcx) zero by a negative (integer) cxpomnt ;
array Operation s whosc mathcrria~tic:al dcfinition involves exponent iation of (mal 01’ complex) zero by a negat ivc
(int cger) exporient ;
NOTE - In ISO/IEC 8652:1987, the exception specified for signaling division by zero is NUMERIC-ERROR, but ISO/IEC 8652:1995
replacesthat by CONSTRAINT-ERROR.
12 Underflow
Floatingpoint hardwarc is typically incapablc of rcprcscnting nonzcro uumbcrs whosc absolute valuc is lcss thau
sorne irriplcrnentat ion-dcfincd rninirnurn. For thr: type REAL, that rninirnurn will be at rnost REAL ' SAFE-SMALL. For thc
subprograrns defincd by this International Standard, whcncvcr thc maximum rc1a.t ivc crror rcquircmcnts permit a sc:ala8r
rcsult (or a scalar component or clcmcnt of a corripositc rosult) whoso absolute valuc is kss than REAL ' SAFE-SMALL
and a prescribcd result is not stipulatcd? thc implcmcntation rnay yicld for that sca1a.r rcsult (or a scalar corriponcnt
or elernent of that corriposito rcsult)
any valuc pcrrnit ted by thc rnaxirnurn relative error rcquircrncnts;
> any nonzcro value lcss than or cqual to REAL ' SAFE-SMALL in rnagnitudc (and having thc corrcct sign? dcss
1)
the rriaxirriurn relative crror rcquirerncnts pcrrnit valucs with cither sign); OI
C ) Zero.
NOTES
1 Whenever the behavior on underflow is as desciibed in 12 b) 01’ 12 c), the maximum relative erlor requirementls arc, in
general, unachievable and arc waived.
2 The rule permits an implementat,ion to deliver a scalar result, (or component, 01‘ element of a composite result) violat ’ing the
maximum relat,ive erKor requiiement,s for aigument ’s for which the mat#hemat,ical result (or component-part of the iesult) equals
01‘ slightly exceeds REAL ' SAFE-SMALL in absolutJe value. Such arguments must, necessarily be very close to an argument# for which
the mathematical result (or componentpait of the result) is less t,han REAL ’SAFE-SMALL in absolut ’e value. In general, this is
the best that tan be expect]ed from a portable implementation with a reasonable amount of effort.
13 Generic Complex Types Package
The generic pat:kage GENERIC-COMPLEX-TYPES dcfi~~s opcraths and tvpw for s(:;tlar c:oIr~plcx aIitheti(:, OIK gcrlcI-i(:
.
COMPLEX-TYPES. Th; (:orrcspolldiI~g gcrl<:r-ic:
formal Paranieter, tht floating-point tvpc REAL, is dcfind for- GENERIC
. -
actual pararnctcr dctcrrriincs thc prccision of thc a~rithnictic to bo uscd in an insta,ntiatioh of this g<:ncric: pa&a.gc.
Tlic Ada packagc spccification for GENERIC-COMPLEX-TYPES is givcn in anncx A.
@ ISO/IEC ISO/IEC 13813:1998(E)
13.1 Types
Two tvpcs arc cicfir~d and cxpoItcd by GENERIC-COMPLEX-TYPES. The typc COMPLEX provides a cartesian represen-
. .
tation of a cornplex nurnber; it is declared as a record with two cornponents which represcnt the real and irnaginary
pbs. Tbc type IMAGINARY is provided to represent a pure irnaginary nurnber; it is declared as a private type whose
full type deciaration rcveals it to IX: dcrived frorn type REAL. *
.
13.2 Constants
i: constant IMAGINARY := 1.0;
j: constant IMAGINARY := 1.0;
Esch const ant rcprcscut s t he irnagiuary uni t valuc.
.
Esch coustant is cxact .
13.3 COMPLEX selection, conversion and composition operations
function RE (X : COMPLEX) return REAL;
function IM (X : COMPLEX) return REAL;
Esch function rct urns thc spccificd cartcsian cornponent-part of X.
Esch fuuction is cxact.
procedure SET-RE (X : in out COMPLEX;
RE : in REAL);
: in out COMPLEX;
procedure SET-IM (X
IM : in REAL);
Esch proccdure rcsct s t hc spccificd (cart csian) cornponcut of X; t he ot her (cartesian) cornponent is unchanged.
Esch proccdure is cxact.
: REAL;
function "+" (LEFT
: IMAGINARY) return COMPLEX;
RIGHT
: REAL;
function "-" (LEFT
RIGHT : IMAGINARY) return COMPLEX;
Esch opcratiou rcturns the COMPLEX result of applving the appropriatcc standa,rd rnathernatical operation for arithmetic
bctwccn real and irnaginary nurnbers. This is also the Standard rnathernatical Operation for cornposing a cornplex
.
nurriber frorri real and irnaginary nurnbcrs.
ThC real con Iponcnt-pa
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...