Interval Arithmetic Speci cation - CiteSeerX

10 downloads 0 Views 441KB Size Report
Given a; b; c; d 2 IR and a; b; c; d > 0 a, +inf] * -c,d] .... Examples: The width WID(X) (16.1) of the entire interval is +1. The midpoint .... Anamed real or integer constant can be used to represent left{enpoint, right{endpoint or ..... To control when a compiler may perform expression-folding, two operators are required: \ " meaningĀ ...
Interval Arithmetic Speci cation Dmitri Chiriaev and G. William Walster Draft revised May 4, 1998 Abstract Compiler support for interval arithmetic requires a speci cation of both the syntax and semantics of the implementation. The Fortran 77 speci cation contained herein de nes a set of extended real intervals and their internal representation for IEEE 754 compliant processors. The de ned set of extended real intervals is closed with respect to arithmetic operations and interval enclosures of real functions. For mathematical details, see [16] and [19].

Contents 1 Introduction

6

2 Extended Real Intervals

7

3 Internal Representation using IEEE numbers

9

4 The empty and entire intervals 12 4.1 The empty interval, ; : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 12 4.2 The entire interval, IR : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 13

5 Language Extensions

5.1 Character Set : : : : : : : : : : : : : : : : : : 5.2 Interval type : : : : : : : : : : : : : : : : : : : 5.3 COMMON, EQUIVALENCE and DATA statements : 5.4 Names for interval intrinsics : : : : : : : : : : 1

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

14 14 14 16 16

5.5 Interval constants : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 17 5.6 Interval read only variables : : : : : : : : : : : : : : : : : : : : : : : : : : : : 18 5.7 Sun f77 pragmas and command line ags : : : : : : : : : : : : : : : : : : : : 18

6 Interval arithmetic operations

19

7 Interval power functions, X**n and

20

X**Y

8 Interval assignment and mixed mode operations 8.1 8.2 8.3 8.4

Interval Value Assignment : : : : : : Interval Expression Assignment : : : ANSI standard conforming behavior : Default behavior : : : : : : : : : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

23 23 24 25 26

9 Interval expression optimization

29

10 Interval set intrinsics.

34

9.1 Expression folding : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 31 9.1.1 Expression folding accross functions and subroutines : : : : : : : : : 32 9.2 Fortran PARAMETER Statements : : : : : : : : : : : : : : : : : : : : : : : : : 33 10.1 10.2 10.3

: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 34 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 34 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 35

ISEMPTY(X) INF(X) SUP(X)

11 Set operations

35

12 Set relations

36

11.1 Intersection (X .IX. Y) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 35 11.2 Interval Hull (X .IH. Y) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 36 12.1 12.2 12.3 12.4

Superset (X .SP. Y). : : : : : Proper superset (X .PSP. Y). Subset (X .SB. Y). : : : : : : Proper subset (X .PSB. Y) : :

: : : :

: : : :

: : : : 2

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

: : : :

36 37 37 37

12.5 In (R .IN. Y) : : : : : : : : : : : 12.6 Disjoint (X .DJ. Y) : : : : : : : : 12.7 Set{equal (X .SEQ. Y) : : : : : : : 12.8 Set{not{equal (X .SNE. Y) : : : : 12.9 Set{less (X .SLT. Y) : : : : : : : : 12.10Set{less-or-equal (X .SLE. Y) : : : 12.11Set{greater (X .SGT. Y) : : : : : : 12.12Set{greater-or-equal (X .SGE. Y) : 12.13Optimization of set relations : : : :

: : : : : : : : :

13 Certainly relations 13.1 13.2 13.3 13.4 13.5 13.6

Certainly{less (X .CLT. Y) : : : : : Certainly{less{or{equal (X .CLE. Y) Certainly greater (X .CGT. Y) : : : Certainly{greater{or{equal (X .CGE. Certainly{equal (X .CEQ. Y) : : : : Certainly{not{equal (X .CNE. Y) : :

14 Possibly relations 14.1 14.2 14.3 14.4 14.5 14.6

: : : : : : : : :

: : : : : : : : :

: : : : : : : : :

: : : : : : : : :

:::: :::: :::: Y) : : :::: ::::

Possibly{less (X .PLT. Y) : : : : : : : : Possibly{less{or{equal (X .PLE. Y) : : : Possibly{greater (X .PGT. Y) : : : : : : Possibly{greater{or{equal (X .PGE. Y) : Possibly{equal (X .PEQ. Y) : : : : : : : Possibly{not{equal (X .PNE. Y) : : : :

: : : : : :

: : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : : : : :

38 38 39 39 40 40 40 41 41

41 42 43 43 43 44 44

44 45 46 46 46 47 47

15 Precedence of Operators

47

16 Special interval functions

48

16.1 Width: WID(X) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 48 16.2 Midpoint: MID(X) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 49 16.3 Mignitude: MIG(X) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 49 3

16.4 16.5 16.6 16.7 16.8

Magnitude: MAG(X) : : : : : : : : : : : Absolute value:ABS(X) : : : : : : : : : Maximum: MAX(X1, X2 [, X3, ...]) Minimum: MIN(X1, X2 [, X3, ...]) NDIGITS(X)

: : : : ::::::::::::::::

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

: : : : :

49 50 50 50 51

17 INT(X)

51

18 Interval versions of mathematical functions

52

18.1 AINT(X) : : : 18.2 ANINT(X) : : 18.3 SQRT(X) : : : 18.4 EXP(X) : : : 18.5 LOG(X) : : : 18.6 LOG10(X) : : 18.7 MOD(X, Y) : 18.8 SIGN(X, Y) : 18.9 SIN(X) : : : 18.10 COS(X) : : : 18.11 TAN(X) : : : 18.12 ASIN(X) : : : 18.13 ACOS(X) : : : 18.14 ATAN(X) : : : 18.15 ATAN2(X, Y) 18.16 SINH(X) : : : 18.17 COSH(X) : : : 18.18 TANH(X) : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

19 Conversions to interval types 19.1 19.2 19.3

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : : : :

52 52 53 53 54 54 54 55 56 56 57 57 57 58 58 59 59 60

60

: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 60 SINTERVAL(X, [Y]) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 61 DINTERVAL(X, [Y]) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 61

INTERVAL(X, [Y])

4

20 Interval I/O editing

20.1 Namelist interval I/O : : : : : : : : : : : : : : : : 20.2 Interval VF editing : : : : : : : : : : : : : : : : : 20.2.1 Interval VF input editing : : : : : : : : : 20.2.2 Interval VF output editing : : : : : : : : 20.3 Interval VE editing : : : : : : : : : : : : : : : : : 20.4 Interval VG editing : : : : : : : : : : : : : : : : 20.5 Single number interval Y editing : : : : : : : : : : 20.5.1 Single number interval input : : : : : : : : 20.5.2 Single number interval output : : : : : : : 20.5.3 Examples of single number interval I/O : : 20.6 Special cases in single number I/O : : : : : : : : 20.7 Single number I/O and internal base conversions : 20.8 List{directed interval I/O : : : : : : : : : : : : : 20.8.1 List{directed interval input : : : : : : : : 20.9 List{directed interval output : : : : : : : : : : : :

21 Acknowledgments

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

: : : : : : : : : : : : : : :

62 63 63 64 64 65 66 66 67 67 70 72 72 73 73 73

74

5

1 Introduction This speci cation de nes a set of representable extended real intervals, a subset of supported intervals and their internal representation for IEEE 754 compliant processors. It is also a speci cation of the needed additions to the syntax and semantics of Fortran 77 with which to implement, test and document intervals. It is not a complete implementation speci cation, although some important implementation issues are addressed. Real interval arithmetic operations are interval enclosures of their point counterparts. So are functions and relations computed using interval arithmetic. This fact, known as the fundamental theorem of interval arithmetic, is important because an interval enclosure of a real function contains the range of a function over the domain de ned by its interval arguments [12]. The property of including the range of a function in an interval result is also referred to as \containment". Sendov [15] extended the domain of interval arithmetic to include unbounded intervals. Walster and Hansen [19] extended the fundamental theorem to include relations as well as functions. Walster [16] de ned a closed system of extended real intervals and extended interval arithmetic to include functions at points of singularity. The practical consequences of these results as implemented herein are: 1. Simple representation: Each supported interval can be represented with a pair of IEEE

oating-point numbers. 2. Algorithm eciency: Branching is minimized. 3. Closure: All arithmetic operations on any supported intervals produce supported intervals. 4. Sharp Results: Whenever possible, sharp1 interval results are produced. 5. Simplicity. User interface complexity is minimized. A complete set of intrinsic interval enclosures of point functions and operations for Fortran is de ned in [7], [19]. This speci cation is con ned to Fortran 77, but is Fortran 90 compatible. For IEEE 754 compliant processors this collection of de nitions yields a consistent closed set of interval operations and intrinsics, even in the presence of arguments and outcomes that would otherwise raise IEEE exceptions. Appendix A contains algorithms for interval operations +, -, *, and / on IEEE 754 compliant processors. An interval X is \sharper" than interval Y, if WID(X) < WID(Y) (see section 16.1), that is,assuming both X and Y contain the correct answer. 1

6

The description of each Fortran intrinsic and operation contains an algorithm illustrating the logic of a possible impelementation. These algorithms are not a part of the body of speci cation. They are provided for IEEE 754 compliant processors only. This speci cation has been written to be as consistent as practical with the Fortran 77 subset of the Fortran 90 Standard. Additions to this speci cation for Fortran 90 and speci cations for other languages will be provided in future interval speci cations.

2 Extended Real Intervals Let IR denote the set of real numbers: IR  fx j ?1 < x < +1g. A real interval, or just an interval, X = [x; x], is a closed, bounded subset of the real numbers, IR:

X  [x; x]  fx 2 IR j x  x  xg ;

where x and x denote the left endpoint or in mum2 and the right endpoint or supremum 3 of the interval X . The set of real intervals is denoted by IIR. An interval is called a point or degenerate interval if X = [x; x] or x = x. The in mum of an interval is always less than or equal to the supremum. The set of extended real numbers, IR, is the set of real numbers, IR, extended with the two ideal points plus and minus in nity: IR = IR [ f?1g [ f+1g. The set of extended real intervals, IIR, is the set of real intervals, IIR, extended with the empty interval, ;, and intervals with one or both in nite endpoints. 8 > > > > > > > > > > >
> f[x; +1] j x 2 IRg [ > [?1; ?1] [ > > > > > [?1; +1] [ > > > : [+1; +1]

where intervals with in nite endpoints are interpreted as follows: [?1; x]  fz 2 IR j z  x, x 2 IR g [x; +1]  fz 2 IR j z  x, x 2 IR g [?1; ?1]  fz 2 IR j z < x, 8x 2 IRg [+1; +1]  fz 2 IR j z > x, 8x 2 IRg [?1; +1]  IR . 2 3

The largest number that is less than or equal to each of a given set of real numbers. The smallest number that is greater than or equal to each of a given set of real numbers.

7

Arithmetic and order operations on real intervals are conveniently de ned in terms of the corresponding operations on the elements of the interval operands. For example:

De nition 1 X op Y = fx op y j x 2 X and y 2 Y g ; where op = f+; ?; ; g , X 2 IR , Y 2 IR , and in the case of division, 0 2= Y .

Remark 1 An interval operation produces an interval containing the set of all results ob-

tainable by performing the operation in question on every element of the argument intervals.

Neither the real nor the extended real number systems are closed with respect to the arithmetic operations. Division by zero is unde ned in the real number system. In the extended real number system, neither division by zero nor the following operations are de ned:

1?1 10 11 (?1) + 1 (?1)  0 (?1)  1 1 + (?1) 01 1  (?1) (?1) ? (?1) 0  (?1) (?1)  (?1)

(1)

To close the system of extended intervals with respect to the arithmetic operators, it is necessary to de ne the result of interval operations on operands involving ;, as well as, combinations of 1 and 0 that are unde ned for points. De nition 1 can be used to de ne operations on extended intervals if division by zero and the point-operation combinations in (1) are de ned. The required de nitions are:

; op X X op ; [1; 1] ? [1; 1] [?1; ?1] + [1; 1] [1; 1] + [?1; ?1] [?1; ?1] ? [?1; ?1] [0; 0] = [0; 0] [1; 1]  [0; 0] [?1; ?1]  [0; 0] [0; 0]  [1; 1]

         

; for op 2 f+; ?; ; g and 8X 2 IIR ; ; for op 2 f+; ?; ; g and 8X 2 IIR ;

IR ; IR ; IR ; IR ; IR ; IR ; IR ; IR ;

8

(2) (3) (4) (5) (6) (7) (8) (9) (10) (11)

[0; 0]  [?1; ?1] [a; a] = [0; 0] [?a; ?a] = [0; 0] [1; 1] = [1; 1] [?1; ?1] = [1; 1] [1; 1] = [?1; ?1] [?1; ?1]= [?1; ?1]

      

IR ;

f?1g [ f+1g = f1g  IR 8 0 < a ; f?1g [ f+1g = f1g  IR 8 0 < a ; 

IR ; IR ;. IR ; and, IR .

(12) (13) (14) (15) (16) (17) (18)

The de nitions in (4 { 18) are shown as operations on degenerate interval operands to make explicit that these de nitions are only required in an extended real interval system. No requirement exists to rede ne anything in the extended real point system. The result of equations (13) and (14) is unsigned or projective in nity. Containment is not violated if IR is returned as the result of division by zero, because projective in nity is contained in IR. The operation-operand combinations in (1) are unde ned in the point system because no single point result makes sense in all situations. Because intervals are sets of values, the de nitions in (4 { 18) can be used to return containing intervals in these cases. The results from the de nitions in (4 { 18) can be used to augment De nition 1:

De nition 2

X op Y = f[x; x] op [y; y] j x 2 X and y 2 Y g ; where op = f+; ?; ; g, X 2 IIR, Y 2 IIR, [x; x] op [y; y] = x op y when x op y is de ned for the points x and y, but whenever x op y is not de ned for points, the de nitions in (4 { 18) are used instead.

3 Internal Representation using IEEE numbers To support the complete set of extended real intervals requires non{IEEE arithmetic operators, or the sacri ce of run{time performance. An alternative is to exclude the intervals [?1; ?1] and [+1; +1] from the set of supported intervals. As a consequence, the invalid operation exception 1 ? 1 is avoided in inlined IEEE oating-point addition and subtraction operations. Without loss of containment or closure, any containing interval can be returned for the result of an operation on supported intervals that produces an otherwise unsupported interval result. In particular, [?inf; ?fp] can be returned in place of [-inf ,-inf] and [+fp; +inf] can be returned in place of [+inf ,+inf] 4 . 4

fp { is the largest representable oating{point number

9

The following requirements are noteworthy in choosing how to map interval endpoints onto the set of IEEE repesentable oating-point numbers:

 provide representations for the empty, ;, and entire, IR, intervals;  use the properties of IEEE oating-point arithmetic to achieve sharpness and speed;  maintain binary compatibility when moving from a software to progressively more

sophisticated hardware supported implementations of interval arithmetic, for example the \Sharp" and the \Full" system described in [16];

 provide good run-time performance in the software implementation using inlined IEEE

addition and subtraction operators; and,  use IEEE features to implement the relative dominance of the empty (;) interval and  the entire (IR ) intervals.

Justi cation for the design decisions made for the rst release of Sun's compiler support for intervals is contained in [17]. The empty interval, ; , is internally represented using the unique internal representation [NaN;; NaN;]; where NaN; is a non-default quiet not-a-number. To provide ecient hardware support, NaN;, must be unique and unobtainable in any other way, for example, as the result of operations such as 0*inf, inf/inf, or 0/0, that produce a default NaN . The entire interval IR is internally represented using [?inf; +inf]. Zero interval endpoints shall be internally represented using either plus or minus zero. Processors that implicitly initialize variables to zero may initialize variables of interval type to [-0,+0], [+0,+0], [+0,-0] or [-0,+0]. This release of support for intervals is based on De nition 2, which is the basis for the \Simple" system in [16]. This system neither uses IEEE signed zero to track the results of under ow nor IEEE signed in nity to track the results of over ow. While the \Simple" system produces results that are less sharp in the presence of under ow and over ow than the \Sharp" and \Full" systems in [16], simplicity is believed to be more important than sharpness in the rst release of compiler support for intervals. Binary compatibility between the \Simple" and the \Sharp" or \Full" systems is maintained, so migration will be possible in the future. Binary compatibility with the \Sharp" and \Full" systems imposes restrictions on the internal representations of 0 and 1 used in binary les. The left zero endpoint must be converted to ?0, and the right zero endpoint must be converted to +0. The left in nite endpoint must be converted to +inf and the right in nite endpoint must be converted to -inf. Therefore, when performing binary output, \[0, 1]" must be output as \[-0, 1]", and \[1, 10

+inf]", output as \[1, -inf]". On input, the sign of zero can be passed without change, as it will be ignored internally in the \Simple" system. This has the e ect of rounding any result of under ow in the \Sharp" and \Full" systems to zero. On the other hand, when \[1, inf]" is read in, it must be stored as \[1, +inf]", for binary compatibility with the \Sharp" and \Full" systems. This has the e ect of rounding any result of over ow in the the \Sharp" and \Full" system to ?1 or +1. See [16] for details. Examples for the \Simple" system (see (4) { (18)) Given a; b; c; d 2 IR and a; b; c; d > 0 [a, +inf] * [-c,d] = [-inf,+inf] [-inf, -b] * [-c,d] = [-inf,+inf]

 0 , d] = [-inf,+inf] [-inf, -b] * [ 0,d] = [-inf,+inf] [-inf, b] * [ 0,d] = [-inf,+inf] [-inf, b] * [-c, 0 ] = [-inf,+inf] For all intervals X 2 IIR : X / [ 0,d] = [-inf,+inf] X / [c, 0] = [-inf,+inf] [a, +inf] * [

X / [-c,d] = [-inf,+inf] [a,+inf]/[c,+inf] =[-inf,+inf] [-inf,-b]/[-inf,-d] =[-inf,+inf] [-inf,-b]/[c,+inf] =[-inf,+inf]

The following table shows the output conversion (in the \Simple" system) from internal binary representation to the external binary and external character representations (x 6= inf, x 6= 0). External binary Output Internal binary Output External character [-0,+0] [-0,+0] [-0,+0] [-0,+0] [-0,x] [-0,x] [x, +0] [x, +0]

? ? ? ? ? ? ? ?

?! ?! ?! ?! ?! ?! ?! ?!

[-0,-0] [-0,+0] [+0,-0] [+0,+0] [+0,x] [-0,x] [x, -0] [x, +0]

11

[0,0] [0,0] [0,0] [0,0] [0,x] [0,x] [x,0] [x,0]

External binary Output Internal binary Output External character [x,-inf] [-0,-inf] [+inf, x] [+inf,-0]

? ? ? ?

[x, +inf] [+0, +inf] [-inf,x] [-inf, +0]

?! ?! ?! ?!

[x, +INF] [0,+INF] [-INF,x] [-INF,0]

The following table shows how (in the \Simple" system) external binary les and character strings are converted into the internal binary representation (x 6= inf, x 6= 0). External binary Input Internal binary Input External character [-0,x] [+0,x] [x, +0] [x, -0] [x,-inf] [x,+inf] [-0,-inf] [-0,+0] [+inf,+0] [+inf,-0] [+inf,x] [+inf, ] [-0, ]

?fp

fp

?! ?! ?! ?! ?! ?! ?! ?! ?! ?! ?! ?! ?!

[-0,x] [+0,x] [x,+0] [x,-0] [x,+inf] [x,+inf] [-0,+inf] [-0,+0] [-inf,+0] [-inf,-0] [-inf,x] [-inf, ] [-0, ]

?fp

fp

? ? ? ? ? ? ? ? ? ? ? ? ?

[0,x] [1e-5000, x] [x,0] [x,-1E-5000] [x, +INF] [x,+INF] [0, +INF ] [0,0] [-INF,0 ] [-INF, -1E-5000 ] [-INF,x ] [-INF, -INF] [0,1E-5000]

4 The empty and entire intervals 4.1 The empty interval, ; Three ways an empty interval can be produced are: by inputing of an empty interval (see section 20); by intersecting, .IX. (11.1), two disjoint intervals; or by evaluating the interval enclosure of a function using an argument that is strictly outside the function's domain of de nition. The latter event does not necessarily imply that an algorithm or coding mistake has been made. The following are de ning properties of the empty interval:

 The empty interval is a degenerate interval constant.  The empty interval is a proper subset, .PSB. (12.3), of every other interval. 12

 The empty interval is set equal, .SEQ. (12.7), to itself.  The empty interval is disjoint, .DJ. (12.6), with any interval, including itself.  The intersection, .IX. (11.1), of the empty interval with any interval, including itself,

is empty.  Any arithmetic operation on an empty operand produces the empty interval.  Any interval enclosure of a point function of one or more arguments is empty when any of its interval arguments is empty. Without loss of containment, interval enclosures of invariant (or constant) functions can safely return the value of the invariant function, even when the argument of the interval enclosure is empty, see [16]. Examples of invariant functions include f (x) = c and f (x) = x , for n = 0.  Any point-valued (non{interval) function of one or more empty interval argument is unde ned. A processor{dependent result shall be returned in this case. The pointvalued functions are: INF, SUP, WID, MID, MIG, MAG, NDIGITS and INT see sections 10 and 16. Note, IEEE processors only. NaN shall be returned for all real{valued functions of an empty interval argument, except that 0 shall be the returned value of NDIGITS(;) (see sec. 16.8), and INT(NaN) shall be the returned value of INT(;) (see sec. 17). n

4.2 The entire interval,

IR

For convenience in the exposition the term entire interval is used to denote the interval IR. The following are de ning properties of the entire interval:

 The entire interval is a non-degenerate interval constant. Two entire intervals must be treated as completely independent, see [19]. Consequently, IR ? IR = IR and IR=IR = IR (see section 6).

 The entire interval is a proper superset, .PSP. (12.2), of every other interval.  Two entire intervals are set{equal, .SEQ. (12.7).  The entire interval is disjoint, .DJ. (12.6), with no other interval except the empty

interval  The intersection, .IX. (11.1), of the entire interval with any interval, X , is X .

13

 The result of any interval arithmetic operation on one or more entire interval operands

is the range of the operation with respect to the entire interval argument(s). This is a consequence of the de nition of the minimum width interval enclosure of a point operation; X:op:Y = ffx:op:yg j x 2 X \ D ; y 2 Y \ D g; where D and D are the domains of the operator's operands, and the set fx:op:yg is x:op:y, if it is de ned, or the set of limiting values of x:op:y at points of singularity, see [16]. x

y

x

y

 The result of evaluating an interval enclosure of a point function with one or more

entire interval arguments is the range of the function with respect to the entire interval argument(s). That is, f (IR) = fff (x)g j x 2 IR \ D = D g; where D is the function's domain of de nition, and the set ff (x)g is f (x) if it is de ned, or is the set of limiting values of f (x) at points of singularity, see [16]. The extension to functions of n-variables is straightforward. p Examples: IR2 = [0; +1]  IR, IR = [0; +1]  IR, and sin (IR) = [?1; 1].  Any point-valued (non-interval) function of one or more entire interval arguments may or may not be de ned. If it is not, a processor shall return a processor-dependent result. The point-valued functions are: INF, SUP, WID, MID, MIG, MAG, NDIGITS and INT, see sections 10, 16 and 17. Examples: The width WID(X) (16.1) of the entire interval is +1. The midpoint MID(X) (16.2) of the entire interval is unde ned. Nevertheless, 0 shall be returned for MID(IR). f

f

f

5 Language Extensions The language extensions described in this section are introduced to enable interval variables to be declared, manipulated, input and output.

5.1 Character Set Processors are assumed to support square brackets, \[" and \]", to delimit literal interval constants, see section 5.5.

5.2 Interval type An interval is a fp{interval if both its endpoints are machine{representable oating-point numbers. Any operation or sequence of operations on fp-intervals de nes an element of the set of real intervals. However, these real intervals may or may not be machine representable. If they are not, outward rounding to a fp-interval that is known to contain the exact result is 14

used. A valid fp-interval implementation must produce fp-intervals that contain the real intervals resulting from any operation or sequences of operations on fp-intervals. Containment is the only required property of a valid fp-interval implementation. Sharpness and speed are goals of an interval algorithm and are measures of the quality of an interval implementation. Intervals are \opaque". That is, there is no language support provided to allow direct access to the underlying machine representation. However, intrinsics exist to access an interval's in mum and supremum. Note: Processors that support the use of COMMON, EQUIVALENCE, argument association, and extensions such as LOC(), and so on, enable programmers to access the underlying internal representation of interval components. The results of such access are processor dependent. See also section 5.3. The precision of each interval data type shall correspond to the precision of a real data type and shall be the same as the precision of the interval's endpoints. Both interval endpoints shall have the same precision.

De nition 3 The DOUBLE PRECISION type is the default interval endpoint precision. Typically this is equivalent to REAL*8

De nition 4 The REAL type is the single interval endpoint precision. Typically this is equivalent to REAL*4.

The

type speci er is used to declare entities of intrinsic type interval. The following types are supported:

INTERVAL INTERVAL

 

- has DOUBLE PRECISION endpoints INTERVAL*n - on processors that support the *n notation for non-CHARACTER types, has REAL*k endpoints, where n=2*k.

INTERVAL

 Sun f77 only.

and INTERVAL*16, types are supported. The default size of the INTERVAL type is INTERVAL*16 and can only be changed using the -xtypemap ag. The -dbl and -r8 ags have no in uence on the default size of interval types. Allowed mapping for -xtypemap is: -xtypemap=interval:32, demoting INTERVAL to INTERVAL*8. INTERVAL*8

15

5.3

COMMON, EQUIVALENCE

and DATA statements

statements are the equivalent of assignment of value, see section 8.1. EQUIVALENCE statement. If an equivalence set contains an interval, all of the objects in the equivalence set shall have the same type. Storage association for COMMON blocks. An interval variable may only be storage associated with an interval variable of the same size. Sun{only Note: Global Program Checking (GPC) should be able to check for interval storage association errors. EQUIVALENCEd variables are dependent. As a consequence, the following compile-time optimization is possible (see also section 9):

DATA

INTERVAL A, B, X EQUIVALENCE A, B A := 0.1 X = A - B ! This can be optimized at compile time to: X = 0

Storage association between interval variables that is accomplished in any way other than EQUIVALENCE will explicitly *not* lead to compile{time optimization.

5.4 Names for interval intrinsics The speci c names5 for interval intrinsics start with \V", followed (if necessary) by \S" for arguments of type INTERVAL*8, and nally followed by the generic name of the intrinsic. To avoid name space clashes the speci c names will be made avilable by means of the -Qoption -ia_support=yes/no"

command line option (see section 5.7). Examples: 5

Speci c Name VSABS VABS

Argument

Result

INTERVAL*8 INTERVAL*16

INTERVAL*8 INTERVAL*16

Sun only

16

5.5 Interval constants Where literal constants are admitted in a program an interval value may be represented as an interval literal constant. interval{literal{constant is [ endpoint] or [ left{endpoint, right{endpoint] left{endpoint is endpoint right{endpoint is endpoint endpoint is signed{int{literal-constant or signed{real{literal-constant For example, [1; 2], [1E0; 3], [1], [1E ? 1] and [:1234D5] are all valid interval literal constants.

Sun only. A named real or integer constant can be used to represent left{enpoint,

right{endpoint or both endpoints of an interval constant. Using named constants to de ne interval constants, users need to take into consideration that: Given PARAMETER(R=0.01), [R] and [R,R] are valid interval constants, containing [0.01]. However given PARAMETER(R=0.1/10), [R] and [R,R] do not contain [0.01] but are valid interval constants, representing a degenerate interval with both endpoints equal to the rounded value of the expression 0.1/10. See also section 9.2.

The use of square brackets as interval constant delimiters (in contrast to \( y and (8y 2 Y; 9x 2 X : x > y) X .SGT. X  FALSE Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x > y and x > y) otherwise has the value false. The result has the value false if one or both of the arguments is empty Algorithm. x > y and x > y 40

12.12 Set{greater-or-equal (X

.SGE. Y)

Description. Determines if one interval is set{greater{or{equal to another. X .SGE.Y  (8x 2 X; 9y 2 Y : x  y) and (8y 2 Y; 9x 2 X : x  y) X .SGE. X  TRUE Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x  y and x  y ) otherwise has the value

false. The result has the value false if only one of the arguments is empty. The result has the value true if both arguments are empty.

Algorithm. x  y and x  y or ISEMPTY (X ) and ISEMPTY (Y )

12.13 Optimization of set relations The following table summarizes the results for X.Sop.X expressions, where .Sop. is one of the set relational oparators: .SLT., .SGT., .SLE., .SGE., .SEQ. or .SNE.

X 6= ; X.Sop.X x = x x 6= x X.SLT.X false false X.SGT.X false false X.SLE.X true true X.SGE.X true true X.SEQ.X true true X.SNE.X false false

X=; false false true true true false

Compile{time optimization can be applied to all of these expressions, because their result is invariant with respect to the value of X.

13 Certainly relations For a relation :op: 2 f; ; ; =; 6=g between two points x and y, the corresponding certainly true relation between two intervals X and Y is 41

X:Cop:Y = TRUE i (8x 2 X; 8y 2 Y : x:op:y = TRUE )

If the empty interval is an operand of a certainly relation then the result is false. The one exception is the certainly{not{equal relation (13.6), which is true in this case. Certainly relations shall be the defaults that are invoked using the following symbolic representation : .LT. .CLT.




.LE. .CLE.

=

.EQ. .CEQ.

.NE. .CNE.

= = = If these operators are supported When both operands are completely dependent, X:Cop:X is de ned : X:Cop:X = TRUE i (8x0 2 X; 8x00 2 X : x0:op:x00 = TRUE ): The following table summarizes the results for X.Cop.X expressions.

X 6= ; X.Cop.X x = x x 6= x X.CLT.X false false X.CGT.X false false X.CLE.X true false X.CGE.X true false X.CEQ.X true false X.CNE.X false false

X=; false false false false false true

Compile{time optimization can be applied to X.CLT.X and X.CGT.X expressions, because their result is invariant with respect to the value of X.

13.1 Certainly{less (X

.CLT. Y)

Description. Determines if one interval is certainly{less than another. X < Y  (8x 2 X; 8y 2 Y : x < y) The result is false if one or both of the arguments is empty. Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x < y). Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm. x < y

42

13.2 Certainly{less{or{equal (X

.CLE. Y)

Description. Determines if one interval is certainly{less{or{equal to another. X  Y  (8x 2 X; 8y 2 Y : x  y) The result is false if one or both of the arguments is empty . Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x  y). Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm.x  y

13.3 Certainly greater (X

.CGT. Y)

Description. Determines if one interval is certainly{greater than another. X > Y  (8x 2 X; 8y 2 Y : x > y) The result is false if one or both of the arguments is empty. Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x > y). Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm. x > y

13.4 Certainly{greater{or{equal (X

.CGE. Y)

Description. Determines if one interval is certainly{greater{or{equal to another. X  Y  (8x 2 X; 8y 2 Y : x  y) The result is false if one or both of the arguments is empty. Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x  y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm. x  y

43

13.5 Certainly{equal (X

.CEQ. Y)

Description. Determines if one interval is certainly{equal to another X = Y  (8x 2 X; 8y 2 Y : x = y) The result is false if one or both of the arguments is empty. Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if ( x  y and x  y ). Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false. Algorithm. x  y and x  y

13.6 Certainly{not{equal (X

.CNE. Y)

Description. Determines if one interval is certainly{not{equal to another X 6= Y  (8x 2 X; 8y 2 Y : x 6= y) The result is true if one or both of the arguments is empty. Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x > y or y > x) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value true. Algorithm. not (x  y and y  x) To get the desired true result if one or both operands are empty, it is necessary to use the complement of (x  y and y  x) rather than (x > y or y > x). This is because NaN is not equal to any number including itself.

Note. The semantic and the algorithm for the .CNE. operator are equivalent to those of the disjoint operator .DJ.

14 Possibly relations For a relation :op: 2 f; ; ; =; 6=g between two points x and y, the corresponding possibly true relation :Pop: between two intervals X and Y is de ned as follows: 44

X:Pop:Y = TRUE i (9x 2 X; 9y 2 Y : x:op:y = TRUE ) If the empty interval is an operand of a possibly relation then the result is false. The one exception is the possibly not equal relation (14.6) which is true in this case. Whenever both intreval operands are completely dependent, X:Pop:X is de ned :

X:Pop:X = TRUE i (9x0 2 X; 9x00 2 X : x0:op:x00 = TRUE ): The following table summarizes the results for X.Pop.X expressions.

X 6= ; X.Pop.X x = x x 6= x X.PLT.X false true X.PGT.X false true X.PLE.X true true X.PGE.X true true X.PEQ.X true true X.PNE.X false true

X=; false false false false false true

Compile{time optimization cannot be applied to any of these expressions, because none of their results are invariant with respect to the value of X.

14.1 Possibly{less (X

.PLT. Y)

Description. Determines if one interval is possibly{less than another. X .PLT.Y  (9x 2 X; 9y 2 Y : x < y) The result is false if one or both of the arguments is empty . Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x < y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm. x < y

45

14.2 Possibly{less{or{equal (X

.PLE. Y)

Description. Determines if one interval is possibly{less-or-equal to another. X .PLE.Y  (9x 2 X; 9y 2 Y : x  y) The result is false if one or both of the arguments is empty . Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x  y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm. x  y

14.3 Possibly{greater (X

.PGT. Y)

Description. Determines if one interval is possibly{greater than another. X .PGT.Y  (9x 2 X; 9y 2 Y : x > y) The result is false if one or both of the arguments is empty . Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x > y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm. x > y

14.4 Possibly{greater{or{equal (X

.PGE. Y)

Description. Determines if one interval is possibly{greater{or{equal to another. X .PGE.Y  (9x 2 X; 9y 2 Y : x  y) The result is false if one or both of the arguments is empty . Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x  y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false.

Algorithm.x  y

46

14.5 Possibly{equal (X

.PEQ. Y)

Description. Determines if one interval is possibly{equal to another. X .PEQ.Y  (9x 2 X; 9y 2 Y : x = y) The result is false if one or both of the arguments is empty . Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x  y and x  y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value false. Algorithm.x  y and x  y

14.6 Possibly{not{equal (X

.PNE. Y)

Description. Determines if one interval is possibly{not{equal to another. X .PNE.Y  (9x 2 X; 9y 2 Y : x 6= y) The result is true if one or both of the arguments is empty. Arguments. X and Y shall be of type interval Result characteristics. Default logical scalar. Result value. The result has the value true if (x > y or x < y) . Otherwise the result has the value false. If one or both of the arguments is empty, the result has the value true. Algorithm. not (x  y and x  y)

Note. To get the desired TRUE result if one or both operands are empty it is

necessary to use the complement of the algorithm for the certainly equal relation rather than (x > y or x < y). This is because NaN is not equal to every number including itself.

15 Precedence of Operators The precedence of interval operations determines the order in which the operands are combined, unless the order is changed by the use of parentheses. The precedence order of interval operators is summarized in the following table. 47

In the absence of parentheses, if there is more than one operator in an expression, then the operators are applied in the order of precedence. With one exception, if the operators are of equal precedence, they are applied left to right. Interval relational operators have the same precedence as the other Fortran relational operators and therefore higher precedence than logical operators. Note: Compile{time expression folding and expression optimization permit any mathematically equivalent mode of evaluation to be substituted for the original expression, parentheses notwithstanding. For example, (A*X)+(B*X) may be optimized to : X*(A+B), if interval expression optimization is permitted, see section 9.1. Category of Operators Precedence operation Numeric ** Highest Numeric * or / Numeric unary + or  Numeric binary + or  Set .IX., .IH.  Relational .SP., .PSP., .SB., .PSB., .IN., .DJ., .SEQ., .SNE., .SLT., .SLE., . SGT., . SGE., .CEQ., .CNE., .CLT., .CLE., .CGT., .CGE., .PEQ., .PNE., .PLT., .PLE., .PGT., .PGE.

Expression

Examples:

X X X X

+ Y .IX. Z + Y .SB. Z .SB. Y .IX. Z .IX. Y .SEQ. Z

Interpretation

Lowest

(X+Y) .IX. Z (X+Y) .SB. Z X .SB. (Y .IX. Z ) (X .IX. Y) .SEQ. Z

16 Special interval functions The real valued functions WID, MID, MIG, and MAG are unde ned for the empty or IR interval argument. A processor{dependent result shall be returned in this case.

16.1 Width:

WID(X)

Description. Width of the non-empty interval. Arguments. X shall be of type interval Result characteristics. The result is of type real. 48

Result value. The result is a processor{dependent approximation of (x ? x). If it is not machine representable then it shall be upwardly rounded. Algorithm.(x ? x) rounded up.

16.2 Midpoint:

MID(X)

Description. Midpoint of the non-empty interval. Arguments. X shall be of type interval Result characteristics. The result is of type real. Result value. The result is a processor{dependent approximation of (x + x)=2. For nonempty argument the result must ful ll the property x  MID(X )  x. Algorithm. if x = x then x else if j x j=j x j then 0, else (0:5  x + 0:5  x)

16.3 Mignitude: MIG(X) Description. The smallest absolute value in the non-empty interval. minfjxj j x 2 X g Arguments. X shall be of type interval Result characteristics. The result is of type real. Result value. The result is minfjxj; jxjg, if 0 62 X ; otherwise the result is 0. Algorithm. minfjxj; jxjg : if 0 62 X 0

16.4 Magnitude:

: otherwise.

MAG(X)

Description. The greatest absolute value in the non-empty interval. maxfjxj j x 2 X g Arguments. X shall be of type interval Result characteristics. The result is of type real. Result value. maxfjxj; jxjg. Algorithm. maxfjxj; jxjg 49

16.5 Absolute value:ABS(X) Description. Range of absolute value. ABS (X )  fjxj j x 2 X g

Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. If the argument is empty, the result is the empty interval. Algorithm. [MIG(X ); MAG(X )]

16.6 Maximum: MAX(X1,

X2 [, X3, ...])

Description. Range of maximum. MAX (X 1; X 2[; X 3; :::])  fmax(x1; x2; [; x3; :::]) j x1 2 X 1; x2 2 X 2[; x3 2 X 3; :::]g

Arguments. The arguments shall be of type interval and all have the same precision. Result characteristics. The result is of type interval. The precision is that of the argu-

ments.

Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. If any argument is empty, the result is the empty interval. Algorithm. [maxfx1; x2[; x3; :::]g; maxfx1; x2[; x3; :::]g]

16.7 Minimum: MIN(X1,

X2 [, X3, ...])

Description. Range of minimum. MIN (X 1; X 2[; X 3; :::])  fmin(x1; x2; [; x3; :::]) j x1 2 X 1; x2 2 X 2[; x3 2 X 3; :::]g

Arguments. The arguments shall be of type interval and all have the same precision. 50

Result characteristics. The result is of type interval. The precision is that of the argu-

ments.

Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. If any argument is empty, the result is the empty interval. Algorithm. minfx1; x2[; x3; :::]g; minfx1; x2[; x3; :::]g]

16.8

NDIGITS(X)

Description. Maximum number of decimal digits (excluding leading zeros) that can be

displayed printing non-empty interval X with the Y interval editing descriptor (see 20.5). Arguments. X shall be of type interval. The NDIGITS function is unde ned for the empty and the entire interval argument. A processor{dependent result (e.g. 0) shall be returned in this case. Result characteristics. Default integer scalar. Result value. The integer result shall be the maximum number of digits in a decimal number y such that X is contained in an interval whose endpoints are de ned by adding and subtracting 1 to the last decimal digit of y. If X is a degenerate non-empty interval (x = x), then the result is MAX INT (the largest representable integer).

Examples NDIGITS NDIGITS NDIGITS NDIGITS

17

([0.0, .5]) = 1 ([1, 1]) = MAX INT ( ) = ([2.345677E+7, 2.345679E+7]) = 7

;

0

INT(X)

Description. Convert the midpoint of the non{empty interval argument to integer type. Arguments. X shall be of type interval Result characteristics. The result is of default integer type. Result value. The result value is INT( MID (X)). 51

The INT function is unde ned for the empty and the entire interval argument. A processor{ dependent result (e.g. 0) shall be returned in this case. Note: IEEE 754 compliant processors only. If the argument is empty the result is a processor dependent value equal to the value of the corresponding point intrinsic with NaN as the argument.

18 Interval versions of mathematical functions All Fortran intrinsic functions that accept real data shall also accept interval data. The results from [16] eliminate any restriction on the domain of any interval enclosures of real functions. Points at which singularities occur in real functions, need not be excluded from the domain of the function's interval enclosures. Extended intervals can always be used to return an interval enclosure.

18.1

AINT(X)

Description. Interval enclosure of the truncation to a whole number function over an

interval.

AINT (X )  fAINT (x) j x 2 X g:

Arguments. X shall be of type interval. Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if argument is empty.

18.2

ANINT(X)

Description. Interval enclosure of the nearest whole number function over an interval. ANINT (X )  fANINT (x) j x 2 X g: Arguments. X shall be of type interval. Result characteristics. Same as the argument. 52

Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if argument is empty.

18.3

SQRT(X)

Description. Interval enclosure of the square root function over an interval. p p X  f x j x 2 X \ [0; +1]g: q

Special values. (IR) = IR Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if argument is empty.

Examples.

SQRT([ -INF, x])= [EMPTY]

if x < 0

SQRT([ -INF, +INF])= [ -INF, +INF]

18.4

EXP(X)

Description. Interval enclosure of the exponential function over an interval. exp(X )  fexp(x) j x 2 X g: Special values. exp(IR) = IR Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if argument is empty.

Examples.

EXP([ -INF, +INF])= [ -INF, +INF]

53

18.5

LOG(X)

Description. Interval enclosure of the natural logarithm function over an interval. log(X )  flog(x) j x 2 X \ [0; +1]g: Special values. log([0]) = [?1]  IR Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

Examples.

LOG([0])= [ -INF, +INF]

18.6

LOG10(X)

Description. Interval enclosure of the common logarithm function over an interval. log 10(X )  flog 10(x) j x 2 X \ [0; +1]g: Special values. log 10([0]) = [?1]  IR Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

Examples.

LOG([0])= [ -INF, +INF]

18.7

MOD(X, Y)

Description. Interval enclosure of the modulo function over an interval. mod(X; Y )  fmod(x; y) j x 2 X; y 2 Y g; where mod(x; y) = x ? y  INT (x=y): 54

Special values. If 0 2 Y then mod(X; Y ) = IR Arguments. The arguments shall be of type interval and of the same precision. Result characteristics. The result is of type interval. The precision is that of the highest

precision argument. Result value. The interval result value shall be an enclosure for the speci ed interval. An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if one or both arguments are empty.

Examples.

MOD( [0], [0] ) = [-INF, +INF ]

18.8

SIGN(X, Y)

Description. Interval enclosure of the SIGN function over an interval. sign(X; Y )  fsign(x; y) j x 2 X; y 2 Y g: Special values. SIGN(IR, X)=IR 8X Arguments. The arguments shall be of type interval. Result characteristics. The result is of type interval. The precision is that of the highest

precision argument. Result value. The interval result value shall be an enclosure for the speci ed interval. An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if one or both arguments are empty.

Examples:

SIGN([-2,-1],[3,4]) = [1,2] SIGN([-1,2],[-4,-3]) = [-2,0] SIGN([1,2],[-4,-3]) = [-2,-1] SIGN([1,2],[0,1]) = [1,2] SIGN([1,2],[-1,0]) = [-2,2] SIGN([1,2],[-INF,+INF]) = [-2,2] SIGN([-INF,+INF],[3,4]) = [-INF,+INF]

55

18.9

SIN(X)

Description. Interval enclosure of the sine function over an interval. sin(X )  fsin(x) j x 2 X g: Special values. sin(IR) = [?1; 1] Note: It is a quality of implementation option to provide a sharp enclosure of denegerate

interval angles modulo . Arguments. X shall be of type interval Result characteristics. Same as the arguments. Result value. The interval result value shall be an enclosure for the speci ed interval. An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

Examples.

SIN([ -INF, +INF])= [ -1,1]

18.10

COS(X)

Description. Interval enclosure of the cosine function over an interval. cos(X )  fcos(x) j x 2 X g: Special values. cos(IR) = [?1; 1] Note: It is a quality of implementation option to provide a sharp enclosure of denegerate

interval angles modulo . Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval. An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

Examples.

COS([ -INF, +INF])= [ -1,1]

56

18.11

TAN(X)

Description. Interval enclosure of the tangent function over an interval. tan(X )  ftan(x) j x 2 X g: Special values. tan([=2+k]) = [?1; +1]; k 2ZZ , tan([?1]) = [?1; +1], tan([+1]) = [?1; +1], tan([?1; +1]) = [?1; +1] Note: It is a quality of implementation option to provide a sharp enclosure of denegerate interval angles modulo . Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval. An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if argument is empty.

18.12

ASIN(X)

Description. Interval enclosure of the inverse sine function over an interval. asin(X )  fasin(x) j x 2 X \ [?1; 1]g: Special values. asin([?1]) = [?=2],asin([0]) = [0], asin([1]) = [=2], Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

18.13

ACOS(X)

Description. Interval enclosure of the inverse cosine function over an interval. acos(X )  facos(x) j x 2 X \ [?1; 1]g: 57

Special values. acos([?1]) = [], acos([1]) = [0], Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

18.14

ATAN(X)

Description. Interval enclosure of the inverse tangent function over an interval. atan(X )  fatan(x) j x 2 X g: Special values. atan([+1]) = [=2], atan([?1]) = [?=2], atan([0]) = [0] Note: It is a quality of implementation option to provide a sharp enclosure of denegerate

interval angles modulo . Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval. An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

18.15

ATAN2(X, Y)

Description. Interval enclosure of the inverse tangent function over an interval. atan2(X; Y )  fatan2(x; y) j x 2 X; y 2 Y g; where atan2(x; y) = ; given h sin  = x; h cos  = y and h = (x2 + y2)1 2 =

Special values. ATAN2(X,Y) = [?; ], 8X j 0 2 X; 8Y j 0 2 Y Arguments. X shall be of type interval, Y shall be of the same type and precision as X. Result characteristics. Same as the arguments. 58

Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if one or both arguments are empty.

18.16

SINH(X)

Description. Interval enclosure of the hyperbolic sine function over an interval. sinh(X )  fsinh(x) j x 2 X g: Special values. sinh([+1]) = [+1], sinh([?1]) = [?1], sinh([0]) = [0] Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

18.17

COSH(X)

Description. Interval enclosure of the hyperbolic cosine function over an interval. cosh(X )  fcosh(x) j x 2 X g: Special values. cosh([+1]) = [+1], cosh([?1]) = [+1], cosh([0]) = [0] Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if the argument is empty.

59

18.18

TANH(X)

Description. Interval enclosure of the hyperbolic tangent function over an interval. tanh(X )  ftanh(x) j x 2 X g: Special values. tanh([+1]) = [1], tanh([?1]) = [?1], tanh([0]) = [0] Arguments. X shall be of type interval Result characteristics. Same as the argument. Result value. The interval result value shall be an enclosure for the speci ed interval.

An ideal enclosure is a fp-interval of minimum width that contains the exact mathematical interval in the description. The result is empty if argument is empty.

19 Conversions to interval types Explicit conversions to the interval from integers, reals or intervals of di erent types are performed with type conversion functions INTERVAL, SINTERVAL, and DINTERVAL.

19.1

INTERVAL(X, [Y])

Description. Convert to interval type. Arguments.

shall be of type integer, real, or interval. Y (optional) shall be of type integer or real. If is of type interval, Y shall not be present. Result characteristics. The result is of default interval type. Result value. The interval result value shall be a valid oating{point interval (see section 2) and shall be an enclosure for the speci ed interval. An ideal enclosure is a fp{interval of minimum width that contains the exact mathematical interval. If both X and Y are present then INTERVAL(X,Y) is an interval containing the interval [X,Y]. If Y is absent and X is interval, then INTERVAL(X) is an interval containing X . If Y is absent and X is not interval, then INTERVAL(X) is INTERVAL(X,X) If Y is less than X or either X or Y or both of them do not represent a mathematical integer or real number (e.g. one or both real argument is a NaN) then IR shall be returned. X X

Examples

60

results in the interval [0.0, 0.0], see section 3 for discussion of the internal representation of [0.0,0.0] on IEEE 754 compliant processors. INTERVAL(1.0, 2.0) results in the interval [1.0, 2.0]

INTERVAL(0.0)

REAL R, S, T INTERVAL X, Y X=INTERVAL(0.1, 0.1) ! Interpretation : R=0.1 ; X=INTERVAL(R,R) ! Some code setting both T ! X Y

R and S

to zero

= R/S ! T is 0/0, which creates a NaN Produce interval [-INF, INF] = INTERVAL(T, S) = INTERVAL(T, T)

19.2

SINTERVAL(X, [Y])

Description. Convert to INTERVAL*8 type. Arguments.

shall be of type integer, real, or interval. Y (optional) shall be of type integer or real. If is of type interval, Y shall not be present. Result characteristics. The result is of INTERVAL*8 type. Result value. The interval result value shall be a valid oating{point interval (see section 2) and shall be an enclosure for the speci ed interval. An ideal enclosure is a fp{interval of minimum width that contains the exact mathematical interval. If both X an Y are present then SINTERVAL(X,Y) is an interval containing the interval [X,Y]. If Y is absent and X is interval, then SINTERVAL(X) is an interval containing X . If Y is absent and X is not interval, then SINTERVAL(X) is SINTERVAL(X,X) If Y is less than X or either X or Y or both of them do not represent a mathematical integer or real number (e.g. one or both real argument is a NaN) then IR shall be returned. X X

19.3

DINTERVAL(X, [Y])

Description. Convert to INTERVAL*16 type. 61

Arguments.

shall be of type integer, real, or interval. Y (optional) shall be of type integer or real. If is of type interval, Y shall not be present. Result characteristics. The result is of INTERVAL*16 type. Result value. The interval result value shall be a valid oating{point interval (see section 2) and shall be an enclosure for the speci ed interval. An ideal enclosure is a fp{interval of minimum width that contains the exact mathematical interval. If both X an Y are present then DINTERVAL(X,Y) is an interval containing the interval [X,Y]. If Y is absent and X is interval, then DINTERVAL(X) is an interval containing X . If Y is absent and X is not interval, then DINTERVAL(X) is DINTERVAL(X,X) If Y is less than X or either X or Y or both of them do not represent a mathematical integer or real number (e.g. one or both real argument is a NaN) then IR shall be returned. X X

20 Interval I/O editing The VF, VE and VG or Y, F, E and G edit descriptors may be used to specify the input/output of interval data. The VF, VE and VG edit descriptors provide [inf; sup] { style formatting of intervals, using F, E, G edit descriptors for the interval endpoints. The Y edit descriptor is used for single{ number interval I/O, see section 20.5. The F, E, G edit descriptors applied to intervals have the same meaning as the Y edit descriptor except that if F w:d or G w:d speci er is used, the output eld may have the form prescribed by the F edit descriptor, (see section 20.5). However, if the E speci er is used, the output eld may only have the form prescribed by the E edit descriptor. The P edit descriptor may be used to change the scale factor for VF, VE and VG descriptors. The P edit descriptor shall not a ect the scale factor for the Y, F, E and G edit descriptors when applied to intervals. BZ control edit descriptor may be used to change the interpretation of non{leading blanks on input using the VF, VE and VG edit descriptor but shall not a ect the the interpretation of blanks using the Y descriptor or the F, E, and G edit descriptors when applied to intervals. The underlying principle in all interval I/O editing is: the interval result shall contain the exact mathematical result. Speci cally:

 The speci ed input/output list item shall be of type interval. 62

{ On input: the stored fp{interval shall contain the decimal interval represented by the input character string; leading blanks are not signi cant. Input of an invalid interval is an I/O error and shall cause the program to abort, unless alternative action (ERR clause) has been provided speci cally in the program. In this case IR is returned. { On output: the printed decimal interval shall contain the internal fp{interval; a zero or positive internal endpoint may be pre xed with a plus sign; a negative endpoint is always pre xed with minus sign; and the zero internal endpoint is never pre xed with a leading minus.

 A plus or minus in nite internal endpoint shall be input/output as INF pre xed with     

a plus or minus sign according to common rules. The empty interval shall be input/output as [EMPTY] using formated or list directed interval I/O. If an output list item corresponding to the VF, VE, VG or Y edit descriptor is not of an interval type the whole output eld shall be lled with asterisks. w and d speci ers shall not be omitted. If an output eld's width w is zero, the processor selects the eld width. On input, w shall not be zero. If the output eld's width, w, in VF, VE or VG edit descriptor is even, then the eld is lled with one leading blank character and w ? 1 is used for the output eld's width.

The input values EMPTY and INF are not case sensitive.

20.1 Namelist interval I/O Interval values can be input and output with NAMELIST I/O.

20.2 Interval

VF

editing

The VFw:d edit descriptor indicates that the eld occupies w character positions and contains one or two numeric elds, each fractional part of which contains d digits.

63

20.2.1 Interval

VF

input editing

Let d-input- eld, d-input- eld1 and d-input- eld2 be valid input elds for Dw0:d, Dw1:d and Dw2:d format speci ers respectively. An input value in a VFw:d edit eld has the form vf-input- eld, where vf-input- eld is d-input- eld , in which case w0 = w or [ d-input- eld ], in which case w0 = w ? 2 or [ d-input- eld1 , d-input- eld2 ], in which case w1 + w2 = w ? 3 If vf-input- eld has the form [d-input- eld1 , d-input- eld2 ], then d-input- eld1 contains the lower bound and the d-input- eld2 contains the upper bound of the input interval. In this case, the lower bound of the internal representation of the variable in the corresponding input item list shall be less than or equal to the value in d-input- eld1 . The upper bound shall be greater than or equal to the value in d-input- eld2 . The internal variable shall contain the input value regardless of the number of digits in the eld or the precision of the internal representation. If vf-input- eld input value has the form d-input- eld or [ d-input- eld ], the internal representation of the corresponding variable in the input list shall have lower bound less than or equal to the value in d-input- eld. The upper bound shall be greater than or equal to the value in d-input- eld. The internal variable shall contain the input value regardless of the number of digits in the input value or the precision of the internal representation.

20.2.2 Interval

VF

output editing

An output value in a VFw:d edit eld has the form vf-output- eld, where vf-output- eld is [ f-output- eld1 , f-output- eld2 ], where w0 = (w ? 3)=2 f-output- eld is the output eld for the Fw0 :d format (for non{interval types), where w0 and d are the values speci ed above. The value in f-output- eld1 shall be less than or equal to the lower bound of the corresponding output list item, regardless of the number of digits in the eld or the internal representation. The value in f-output- eld2 shall be greater than or equal to the upper bound of the corresponding output list item, regardless of the number of digits in the eld or the precision of the internal representation. Using the speci ed format, if one or both f-output- eld1 or f-output- eld2 elds are too small for the output of the corresponding endpoint, then only that eld must be lled with asterisks. For both input and output, the symbols \[ ", \] " and \," that are part of the eld shall be counted as part of the width w of the overall VF eld. The total width of the eld is thus 2w0 + 3. 64

Examples. Suppose it is required to input the degenerate interval [1:5; 1:5] and the READ statement is: INTERVAL X READ(*, '(1X, VF18.5)') X

Then any of the following input lines result in an internal representation for X that is equal to or contains the interval [1:5; 1:5]: 1.5 1.5E0 [1.5] [1.5, 1.5]

The output of resulting internal interval with VF18.5 descriptor has the following form: 123456789012345678 ! position number [1.50000,1.50000]

20.3 Interval

VE

editing

The form and interpretation of the ve-input- eld shall be the same as for VF input editing in section 20.2.1. An output value in a VEw:d[Ee] edit eld has the form ve-output- eld, where ve-output- eld is [ e-output- eld1 , e-output- eld2 ], where w0 = (w ? 3)=2 e-output- eld is the output eld for the Ew0:d[Ee] format (for real types), where w0, d, and e are the values speci ed above. The value in e-output- eld1 shall be less than or equal to the lower bound of the corresponding output list item, regardless of the number of digits in the eld or precision of the internal representation. The value in e-output- eld2 shall be greater than or equal to the exact upper bound of the corresponding output list item, regardless of the number of digits in the eld or precision of the internal representation. Using the speci ed format, if one or both e-output- eld1 or e-output- eld2 elds are too small for the output of the corresponding endpoint, then only that eld must be lled with asterisks. For both input and output, the symbols \[ ", \] " and \," that are part of the eld shall be counted as part of the width w of the overall VE eld. The total width of the eld is thus 2w0 + 3: 65

Example: Let the interval variable, X be de ned in a program, and suppose the program containes the statement : WRITE(*, '(1X, VE27.5E1)') X

Let the internal representation of X be: [1.9921875, 2.9921875]

Then valid output produced by the WRITE statement is 123456789012345678901234567 ! position number [ 0.19921E+1, 0.29922E+1]

20.4 Interval

VG

editing

For interval input, the interval VG edit descriptor is identical to the VF edit descriptor. For interval output with VGw:d or VGw:dEe, two decimal numbers are printed, preceded by \[ ", separated by \, " and followed by \] ". The formats of the lower bound and upper bound are determined in accordance with the rules for non{interval Gw:d or Gw:dEe editing for the lower and upper bound of the output interval, respectively. The printed lower and upper bounds shall contain the internal interval representation. Using speci ed format, if one or both output elds are too small for the output of the corresponding endpoint, then only that eld must be lled with asterisks.

20.5 Single number interval Y editing The Y edit descriptor formats single number input and output of interval's with implicit bounds of 1 unit in the last exhibited decimal digit. The letter Y is chosen as a visual indicator of the relationship of the components of an interval value to the single number used to represent that value, as illustrated here:

Y

inf sup single number representation

The P edit descriptor does not a ect the scale factor for the Y edit descriptor. The general form of the Y edit descriptor is: 66

w:d[Ee] w indicates that the eld to be edited occupies w positions. On output, if the eld's width w is zero, the processor selects the eld width. On input, w shall not be zero. The d speci er sets the minimumnumber of places allocated for displaying signi cant digits10. The e speci er (if present) de nes the number of digits displayed in the exponent part of the output eld. The presence of the e speci er forces the output eld to have the form Y

prescribed by the

E

(as opposed to

F

) edit descriptor.

20.5.1 Single number interval input Leading blanks are not signi cant. Other blanks are also ignored. The BZ control edit descriptor does not a ect the the interpretation of blanks on input using the Y descriptor. A eld containing only blanks is considered to be zero. The d and e speci ers are ignored on input. An input value in a Yw:d edit eld has the form y-input- eld, where y-input- eld is d-input- eld, in which case w0 = w or [ d-input- eld ], in which case w0 = w ? 2 d-input- eld is a valid input eld for the Dw0:d format, where w0 is the value speci ed above. The internal representation shall depend upon whether the input string contains a decimal point. If the input eld contains a decimal point, the internal interval value shall contain the interval de ned by the input number in the d-input- eld, 1 decimal unit in the least significant digit. If the input eld does not contain a decimal point, the internal representation shall be the same as if the VF w:d format speci er with d = 0 had been used.

20.5.2 Single number interval output The interval variable in the corresponding output item list shall be contained in the interval constructed by adding and subtracting 1 to the last decimal digit of the output eld. The output eld is enclosed in an obligatory \[" and \]". If it is possible to represent a degenerate interval within the eld width, it will be right justi ed with no decimal point. The value for d is ignored and the mantissa of the number is printed without any leading or trailing zeros. If the e speci er is absent in Y or G descriptor, then ve trailing blanks shall be added to the mantissa. 10

The actual number of displayed signi cant digits may be more or less than d

67

Internal Interval [0.5] [123] [123] [19] [20] [21] [19] [20] [21] [1000001] [1000001] [1000000]

Output Field 12345678901234567890 [ 5E-001] [ 123E+0000] [ 123 ] [ 19 ] [ 2E+001] [ 21 ] [ 19E+000] [ 2E+001] [ 21E+000] [ 1000001E+000] [ 1000001 ] [ 1E+006]

Edit Descriptor Y12.2 Y17.5E4 Y17.5 or F17.5 Y17.5 or F17.5 Y17.5 or F17.5 Y17.5 or F17.5 Y17.5E3 or E17.5 Y17.5E3 or E17.5 Y17.5E3 or E17.5 E17.5 {F,G,Y}17.5 {F,G,Y}17.5

If there is sucient eld width, the E or F style will be used. The E or F descriptor is used that can display the greater number of digits of the interval in the output list. If the number of digits displayed using E or F descriptor are the same, the F descriptor is used. The d speci er sets the minimum number of signi cant digits displayed. It is possible to have more signi cant digits using the F descriptor. That is why \d" is the minimum number of signi cant digits. Positions corresponding to the digits that are not displayed shall be lled with blanks. If e is speci ed, the exponent character is E, followed by a sign and followed by e digits. The default for e speci er is 3. An additional exponent digit can be displayed instead of \E" character if necessary. The exponent eld (if present) is always right justi ed in the output eld. The w speci er must be at least d + 10 for the Yw:d speci cation. A warning should be issued otherwise. If the number of digits in the exponent is speci ed, w must be at least d + e + 7 for the Yw:dEe speci cation: A warning should be issued otherwise. If there is a decimal point, it shall be located in position p = e + d + 4, counting from the right of the eld of w characters. To the extent that w  p + 2 (2 = left bracket and sign), there will be character positions available for the integer part of a number in F format. If there are not enough character positions available to display a number using the F format and keep the decimal point located in the p{th position, then the E format shall be used. Thus the form of the output eld using either the E or F format is. 68

[ y-output- eld ] where y-output- eld has the form speci ed by either the F(w ? 2):(d + e +2) or F(w ? 2):(d + 3 + 2) or by the E(w ? 2):dEe speci er. The following details of the output eld are processor{dependent: the leading zero before the decimal point, the plus sign for a positive value, and the form of the exponent if the absolute value of the exponent is  999 or > 9999 and \E" character is omitted. If the width of the output eld allows, the leading zero before the decimal point should be output, If the width of the output and exponent elds allows, the form of the exponent eld should be \E", followed by a sign, followed by three or e digits.

69

Thus the following output is desirable: FORMAT(Y17.6) 12345678901234567 [-0.123456789 ]

! position number ! represents the interval [-0.123456790, -0.123456788]

FORMAT(Y17.6E4 ) 12345678901234567 [-0.123457E+0000]

! position number ! represents the interval [-0.123456790, -0.123456788]

FORMAT(Y17.6) 12345678901234567 [-0.123456789123] [-1.2 ]

! position number ! represents the interval [-0.123456789124 ,-0.123456789122] ! represents the interval [-1.3,-1.1]

FORMAT(Y17.6E4 ) 12345678901234567 [ 0.123 E+0021] [-0.12 E+0305] [ 0.12 E+1234] 12345678901234567

! ! ! ! !

***************

! Trying to output .12Q1234 using Y15.5E3

FORMAT(Y15.5 ) 123456789012345 [ 0.123 E+021] [-1.2 ] [-0.120 E+003] [-0.12 E+305] [ 0.12 E+305] [ 0.12 +1234] 123456789012345

! ! ! ! ! ! ! !

position number represents the interval [0.122E21, 0.124E21] represents the interval [-0.13E+0305, -0.11E+0305] represents the interval [0.11Q+1234,0.13Q+1234] position number

position number represents the interval represents the interval represents the interval represents the interval represents the interval represents the interval position number

[0.122E+021, 0.124E+021] [-1.3,-1.1] [-0.121E+003,-0.119E+003] [-0.13E+305,-0.11E+305] [0.11E+305, 0.13E+305] [0.11Q+1234,0.13Q+1234]

20.5.3 Examples of single number interval I/O Format = Y14.4, Internal interval [1.236, Output String: 12345678901234

1.239]

! position number

70

[ 1.24

]

Format = Y14.4, Internal Interval [11111, Output String : 12345678901234 [ 0.2 E+005]

22222]

! position number

Suppose it is desired to input the interval [1:5  :001]. Suppose the READ statement is: INTERVAL X READ(*, '(1X, Y18.5)') X

Any of the following inputs result in an internal representation for interval [1:499; 1:501] :

X

that contains the

1.500

or

1.500E0

or

[1.500]

The following inputs result in an internal representation for X that contains the degenerate interval [1:5; 1:5]. 15E-1

or

[15E-1]

The interval [-10, 10] can be input by: 0.E1

or

[0.E1]

or

0.0E2

or

[0.0E2]

71

20.6 Special cases in single number I/O If either interval endpoint is internally represented by INF then

 If both interval endpoints are less or equal than zero then [-1.

E+INF]

is used for

the output. On input [-1. E+INF] is interpreted as the interval [?1; 0].  If both interval endpoint are greater or equal than zero [+1. E+INF] is used for the output. On input [+1. E+INF] is interpreted as the interval [0; +1].  Otherwise [0. E+INF] is used for the output. On input [0. E+INF] is interpreted as the interval [?1; +1] Thus, the entire interval IR is represented by [0. E+INF] on input and output.

The number of blanks between \." end

E

depends on the w value of the format in use.

20.7 Single number I/O and internal base conversions In single number interval I/O, input immediately followed by output can appear to suggest that a decimal digit of accuracy has been lost, when in fact radix conversion has caused a 1 ulp (unit in the last place) increase in the width of the stored input interval. For example, an input of [1.37] followed by an immediate print will result in [1.4] being output. Users must use character input and output to exactly echo input values and internal reads to convert input values into fp{intervals. For example, an interaction with the program

C

INTERVAL X CHARACTER*30 BUFFER TEST INTERNAL INPUT AND OUTPUT PRINT *, 'ENTER INPUT INTERVAL:' READ (*,'(A12)'), BUFFER PRINT *, 'YOUR INPUT WAS:', BUFFER READ(BUFFER, '(Y12)'), X PRINT *, 'RESULT INTERVAL IS:', X PRINT *, 'SINGLE NUMBER INTERVAL OUTPUT PRINT( '(Y12.2)'), X END

results in 72

IS:'

ENTER INPUT INTERVAL: 1.37 YOUR INPUT WAS:1.37 RESULT INTERVAL IS: [ 1.3600000000000, SINGLE NUMBER INTERVAL OUTPUT IS: [1.4 ]

1.3800000000001]

20.8 List{directed interval I/O 20.8.1 List{directed interval input If an input list item is of interval type the input record must contain an interval value or a null value. An input interval value may have the same form as an interval, real or integer literal constant. If interval value has a form of real or integer literal constant, the input is interpreted as a degenerate interval. In this cae \[ " and \] " are optional The end of record may occur between the left endpoint and the comma or between the comma and the right endpoint. A null value, such as between two consecutive commas, means that the corresponding variable in the input list is not changed. A null value shall not be used for either left or right endpoints of an interval constant, but a single null value may be used to represent a complete interval datum.

20.9 List{directed interval output List{directed output of intervals is identical to output using the VG edit descriptor, with reasonable, processor-dependent values of w, d, and e. Note. Sun only The values for d and e are the same as for the real types corresponding to the endpoints. The value of w re ects the need to conveniently accomodate two real values of corresponding types and tree addtional characters for \[", \]" and the comma. List element w d e INTERVAL*8 15*2+3 7 2 INTERVAL*16 25*2+3 16 2 An end of record may occur between the comma and the right endpoint only if the entire constant is as long as, or longer than, an entire record. The only embedded blanks permitted within an interval constant are between the comma and the end of the record and one blank at the beginning of the record. 73

21 Acknowledgments The authors are very thankful to Keith Bierman, Craig Burley, Eldon Hansen, David Hough, Vladimir Kharchenko, Douglas Priest, Michael Schulte and Wolfgang Walter for valuable remarks.

Appendix A Implementation Multiplication and division can be implemented in software using the respective IEEE operators. The correct signs of zero and in nity are determined from the signs of the operands and endpoint being computed. IEEE addition and subtraction can be used.

Interval Addition

Input: X= [a,b], Y = [c,d] Output: X+Y f Intervals [?1; ?1] and [+1; +1] cannot occur by construction g

Save Rounding Mode ; Set Rounding Mode Up; l = ?(?a ? c) u=b+d Restore Rounding Mode ; return [l; u]

Interval Subtraction

Input: X= [a,b], Y = [c,d] Output: X-Y f Intervals [?1; ?1] and [+1; +1] cannot occur by construction g

Save Rounding Mode ; Set Rounding Mode Up; l = ?(?a + d) u=b?c Restore Rounding Mode ; return [l; u]

74

Interval multiplication Input: X= [a,b], Y = [c,d] Output: X*Y

Save Rounding Mode ; Set Rounding Mode Up; if a > 0 fX > 0g if c > 0 fY > 0g l = ?(?a  c) u=bd else if d < 0 fY < 0g l = ?(?b  c) u=ad else f 0 2 Y g l = ?(?b  c) u=bd else if b < 0 fX < 0g if c > 0 fY > 0g l = ?(?a  d) u=bc else if d < 0 fY < 0g l = ?(?b  d) u=ac else f 0 2 Y g l = ?(?a  d) u=ac else f 0 2 X g if c > 0 fY > 0g l = ?(?a  d) u=bd else if d < 0 fY < 0g l = ?(?b  c) u=ac else f 0 2 Y g l = ? max(?a  d; ?b  c) u = max(a  c; b  d)

endif if isnan(l) or isnan(u) if not (isnan(a) or isnan(c) ) fBoth are not empty g l = ?1 u = +1 endif endif

Restore Rounding Mode ; return [l; u]

75

Interval division

Input: X= [a,b], Y = [c,d] Output: X / Y

Save Rounding Mode ; Set Rounding Mode Up; if (isnan(a) or isnan(c) ) fOne or both is empty g l = NaN; u = NaN; else if c  0 and d  0 f 0 2 Y g l = ?1 u = +1 else if (a == ?1 or b == +1) and (c == ?1 or d == +1) f Intervals [?1; ?1] and [+1; +1] cannot occur by construction g l = ?1 u = +1 else if a  0 and b  0 f 0 2 X g if c > 0 fY > 0g l = ?(?a=c) u = b=c else f if d < 0 g fY < 0g l = ?(?b=d) u = a=d else if a > 0 fX > 0g if c > 0 fY > 0g l = ?(?a=d) u = b=c else f if d < 0 g fY < 0g l = ?(?b=d) u = a=c else f if b < 0 g fX < 0g if c > 0 fY > 0g l = ?(?a=c) u = b=d else f d < 0 g fY < 0g l = ?(?b=c) u = a=d

endif

Restore Rounding Mode ; return [l; u] 76

References [1] Abramowitz, M., and Stegun. I., Handbook of Mathematical Functions, Dover Publications, Inc., New York, 1972. [2] Corbett, R.P., Enhanced Arithmetic for Fortran, SIGPLAN Notices, Vol. 17, No. 12, 1982 [3] ANSI/IEEE 754-1985 Standard for Binary Floating-Point Arithmetic, Institute of Electrical and Electronics Engineers, New York, 1985. [4] Hansen, E.R, Global Optimization Using Interval Analysis, Marcel Dekker, Inc., New York, N.Y., 1992. [5] Hough, D., post to [email protected] mailing list, 1995. [6] ISO/IEC JTC1/SC22/WG5 - N1231, Technical Report for Floating Point Exception Handling. [7] ANSI X3J3 1996-156, Interval Arithmetic|The Data Type and Low-Level Operations, 1996. [8] X3J3/97-155, ISO/IEC JTC1/SC22/WG5 - N1231, Proposed Syntax{ Exceptions for Interval Intrinsic Functions. [9] Kearfott, R. B., et al. A speci c proposal for interval arithmetic in Fortran, 1996. http://interval.usl.edu/F90/f96-pro.asc [10] Kramer, W., Kulisch, U., Lohner, R., Numerical Toolbox for Veri ed computing II. Advanced Numerical Problems, Springer{Verlag, 1998. (to appear) [11] M77 Reference Manual. Minnesota Fortran 1977 Standards Version Edition 1. University of Minnesota, 1983. [12] Moore, R.E., Interval Analysi, Prentice-Hall, Englewood Cli s, N.J., 1966. [13] Moore, R.E., "Methods and applications of interval analysis", SIAM Studies in Applied Mathematics. SIAM, Philadelphia, Pennsylvania, 1979. [14] Popova, E., Interval Operations Involving NaNs, Reliable Computing Vol. 2, No. 2, pp. 161{165. [15] Sendov, B., Some topics of segment analysis, In: Interval Mathematics, Ed. Nickel, K., Academic Press, pp. 203{222, 1980. 77

[16] Walster, G.W., The Extended Real Interval System, Manuscript, 1998. http://www.mscs.mu.edu/ georgec/Classes/GlobSol/Papers/extended intervals.ps [17] Walster, G.W. Compiler Support for Interval Arithmetic with Inline Code Generation and Nonstop Exception Handling, Manuscript, 1998. [18] Walster, G.W., Philosophy and Practicalities of Interval Arithmetic, in Moore (Ed.) Reliability in Computing. Academic Press, Inc., San Diego, California, pp. 309{323, 1988. [19] Walster, G.W., and Hansen, E.R., Interval Algebra, Composite Functions and Dependence in Compilers, Manuscript, 1997. http://www.mscs.mu.edu/ georgec/Classes/GlobSol/Papers/composite.ps [20] Yakovlev, A.G., Classi cation approach to programming of localizational (interval) computations, Interval Computations, 1(3), 1992.

78