ISO/IEC 13813:1998
(Main)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)
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
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)
---------------------- Page: 1 ----------------------
ISO/IEC 13813:1998(E)
Contents Page
............................................. V
Foreword
Introduction vi
..........................................
1 Scope . 1
1
2 Normative referenccs
.................................
3 Types and operations provided 2
.........................
.
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
13
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
---------------------- Page: 2 ----------------------
@ ISO/IEC ISO/IEC 13813:1998(E)
13
13.7 IMAG INARY sclcc t ion, conversion and composi t ion operat ions
13
13.8 IMAGINARY ordinal and arithmetic: opcrations . . . . . . . . .
14
13.9 hilixcd REAL and IMAGINARY arithmetic opcrations. . . . . .
15
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
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
26
16.10 COMPLEX-MATRIX scaling operations . . . . . . . . . . . . . . . .
27
16.11 Othor COMPLEX-MATRIX operations . . . . . . . . . . . . . . . . .
27
17 Gcneric Complex Input/Output Packagc . . . . . . . . . . . . . . . . . .
29
18 Standard non-gcncric: packagcs . . . . . . . . . . . . . . . . . . . . . . . . .
Annexes
30
A Ada specification for GENERIC-COMPLEX,TYPES. . . . . . . . . . . . . .
B Ada spccification for ARRAY-EXCEPTIONS . . . . . . . . . . . . . . . . . . 33
34
C Ada spccification for GENERIC-REAL-ARRAYS . . . . . . . . . . . . . . .
36
D Ada spwification for GENERIC-COMPLEX,ARRAYS . . . . . . . . . . . . .
41
E Ada spccification for COMPLEX-IO . . . . . . . . . . . . . . . . . . . . . . .
42
F Rat,ionalc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
F.l Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
F.2 Introdwtion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
F.3 What Basic: opcrations arc inc:ludcd ‘! . . . . . . . . . . . . . . .
43
F.4 Sclccting an arrav indcx siibtypc . . . . . . . . . . . . . . . . . .
.
.
F.5 Tbc usc of ovcrloadings versus default valucs . . . . . . . . . 44
45
F.6 Shoiild const ants lw incliidcd ‘! . . . . . . . . . . . . . . . . . . . .
45
F.7 why
.
47
F.8 Tbc * nsc of opcrator not,ation vc1w1s function not,ation . . .
47
F.9 Complcx arithmctic . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . .
111
---------------------- Page: 3 ----------------------
@ ISO/IEC
ISO/IEC 13813:1998(E)
.......................... 48
F.10 Accuracy requircmcnts
.
................. 49
F.ll Narrling and renarr~irlg <:onverlt,ions
................................... 50
F.12 Genericity
51
.............................
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
52
......................
ok1.j cc t ivcs and conscql mlccs
53
..........................
F.17 Ada 95 considcrations
55
G Ada 95 specifications of array packages . . . . . . . . . . . . . . . . . . .
.
61
H Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv
---------------------- Page: 4 ----------------------
ISO/IEC 13813:1998(E)
@ 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.
---------------------- Page: 5 ----------------------
@ ISO/IEC
ISO/IEC 13813:1998(E)
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
---------------------- Page: 6 ----------------------
INTERNATIONAL STANDARD 0 IWIEC
ISO/IEC 13813:1998(E)
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.
1
---------------------- Page: 7 ----------------------
ISO/IEC 13813:1998(E) @ ISO/IEC
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.
2
---------------------- Page: 8 ----------------------
@ 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:.
3
---------------------- Page: 9 ----------------------
@ ISO/IEC
ISO/IEC 13813:1998(E)
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.
4
---------------------- Page: 10 ----------------------
@ 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 ar
...
Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.