J3/97-155 Date: April 9, 1997 To: X3J3 From: R. Baker Kearfott (on behalf of the interval email discussion group) Subject: Proposed Syntax -- Exceptions for Interval Intrinsic Functions References: X3J3/97-141, ISO/IEC JTC1/SC22/WG5 - N1231 Introduction ____________ As explained in X3J3/97-141, three cases can occur when interval intrinsics are called: 1. The argument can be entirely within the domain of definition. 2. The the argument can be partially within the domain of definition. 3. The argument can be totally outside the domain of definition. For example, SQRT((<0.0,1.0>)) falls under the first case, SQRT((<-1.0,1.0>)) falls under the second case, and SQRT((<-1.0,-0.5>)) falls under the third case. In some user applications in which the second case occurs, it is appropriate to return an enclosure for the range over the valid portion of the domain, while, in other applications, it is appropriate to stop. Paper X3J3/97-141 has been discussed within the group of "interval experts," with the following consensus. Proposed Syntax ________ ______ There shall be two exception flags associated with the interval intrinsics: There shall be a data type INTERVAL_FLAG TYPE, with two possible values: INTERVAL_OUT_OF_RANGE and INTERVAL_POSSIBLY_OUT_OF_RANGE. The following elemental subroutines shall access the flags. In them, FLAG shall be one of INTERVAL_OUT_OF_RANGE and INTERVAL_POSSIBLY_OUT_OF_RANGE. FLAG_VALUE and HALTING are logical variables. FLAG_VALUE=.TRUE. means that the exception has occurred, and HALTING=.TRUE. means that normal execution is discontinued when the corresponding exception is raised. The initial value of HALTING for both exception flags INTERVAL_OUT_OF_RANGE and INTERVAL_POSSIBLY_OUT_OF_RANGE shall be "TRUE". Whenever HALTING for FLAG is .TRUE. and evaluation of an expression causes FLAG_VALUE to be set to .TRUE., halting is not necessarily immediate, but normal execution does not continue. INTERVAL_POSSIBLY_OUT_OF_RANGE shall be .TRUE. whenever INTERVAL_OUT_OF_RANGE is .TRUE. INTERVAL_GET_FLAG(FLAG,FLAG_VALUE) Get an exception flag. INTERVAL_GET_HALTING_MODE(FLAG, HALTING) Get halting mode for an exception. Halting is not necessarily immediate, but normal processing does not continue. INTERVAL_SET_FLAG(FLAG,FLAG_VALUE) Set an exception flag. INTERVAL_SET_HALTING_MODE(FLAG,HALTING) Controls continuation or halting on interval exceptions. These specifications of the above four elemental subroutines are consistent with the specifications of IEEE_GET_FLAG, IEEE_GET_HALTING_MODE, IEEE_SET_FLAG, and IEEE_SET_HALTING_MODE as defined in ISO/IEC JTC1/SC22/WG5 - N1231, "Technical Report for Floating Point Exception Handling." If the value of the halting mode INTERVAL_POSSIBLY_OUT_OF_RANGE is .FALSE., then the argument of the intrinsic is intersected with the valid domain of the interval intrinsic. (The valid domain of an interval intrinsic function shall be the set of intervals contained in the valid domain of the corresponding floating point intrinsic function.) Examples ________ 1. Upon evaluation of SQRT(<-1.0,-0.5>), both INTERVAL_OUT_OF_RANGE and INTERVAL_POSSIBLY_OUT_OF_RANGE are set to .TRUE. 2. Suppose INTERVAL_OUT_OF_RANGE and INTERVAL_POSSIBLY_OUT_OF_RANGE are both .FALSE. immediately prior to evaluation of the expression SQRT(<-1.0,1.0>). Upon evaluation of SQRT(<-1.0,1.0>), INTERVAL_OUT_OF_RANGE remains .FALSE. but INTERVAL_POSSIBLY_OUT_OF_RANGE is set to .TRUE. If HALTING for INTERVAL_POSSIBLY_OUT_OF_RANGE is .FALSE., then execution continues, and the value of SQRT(<-1.0,1.0>) is the same as the value of SQRT(<0.0,1.0>). --------------------------------------------------------------- R. Baker Kearfott, rbk@usl.edu (318) 482-5346 (fax) (318) 482-5270 (work) (318) 981-9744 (home) URL: http://interval.usl.edu/kearfott.html Department of Mathematics, University of Southwestern Louisiana USL Box 4-1010, Lafayette, LA 70504-1010, USA ---------------------------------------------------------------