FloatingPointCommon: CEDAR DEFINITIONS = BEGIN Flag: TYPE = BOOL ¬ FALSE; Exception: TYPE = MACHINE DEPENDENT { invalidOperation, -- bad argument, bad operation, other fatal error overflow, -- floating point overflow (result would be out of range) divisionByZero, -- division by zero underflow, -- floating point underflow inexactResult, -- result would be inexact other -- any other reason }; ExceptionFlags: TYPE = PACKED ARRAY Exception OF Flag; NoExceptions: ExceptionFlags = ALL[FALSE]; AllExceptions: ExceptionFlags = ALL[TRUE]; NumberType: TYPE = MACHINE DEPENDENT { zero, -- +0.0 or -0.0 subnormal, -- denormalized numbers normal, -- normalized numbers infinity, -- +infinity or -infinity quiet, -- a quiet (non-signaling) NaN (Not a Number) signaling, -- a signaling NaN (Not a Number) other}; -- any other pattern that is NaN ValidNumberType: TYPE = NumberType[zero..normal]; Error: ERROR [code: Exception]; SupportedExceptionErrors: PROC RETURNS [ExceptionFlags]; SupportedStickyFlags: PROC RETURNS [ExceptionFlags]; GetStickyFlags: PROC RETURNS [ExceptionFlags]; SetStickyFlags: PROC [new: ExceptionFlags ¬ NoExceptions] RETURNS [old: ExceptionFlags]; END. ¤ FloatingPointCommon.mesa Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) June 22, 1989 1:23:55 pm PDT This interface describes the common flags and exceptions shared by REAL and DREAL support. Exceptions do not distinguish between REAL and DREAL operations. Although these exceptions are based on the IEEE standard, it is permitted to not support all of them. Although these number types are based on the IEEE standard, floating point support is allowed that fits in as a subset of the IEEE standard. For example, floating point support that does not include denormalized numbers (subnormal) is explicitly allowed. A REAL or DREAL number with this classification corresponds to an actual point on the real number line. Error is raised if any supported exceptions occurs. The code argument reports the kind of exception. No resumption is possible. This operation indicates which exception flags are supported by Error. It is permitted for none of the flags to be supported by the primitive operations. This operation indicates which exception flags are supported by GetStickyFlags and SetStickyFlags. It is permitted for none of the flags to be supported. The various exceptions may have independent "sticky" flags that remember if the exception has occurred since the last call to SetStickyFlags. SetStickyFlags is provided so that procedures may save and restore the state for others. Ês–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Ïeœ7™BK™0—K˜K™Iblockš œCÏkœžœ1žœžœ ™œheadšÏnœžœž œž˜.K˜—šœžœžœžœ˜K™—šœ žœžœž œ˜%KšœÏc1˜CKšœ  9˜DKšœ ˜#Kšœ  ˜'Kšœ ˜)Kšœ ˜šœ˜Kšœ+žœ6™e—K˜—š œžœžœžœ žœ˜6K™—KšŸ œžœžœ˜*KšŸ œžœžœ˜*K˜šœ žœžœž œ˜&Kšœ ˜Kšœ  ˜"Kšœ ˜Kšœ  ˜#Kšœ -˜4Kšœ  !˜,Kšœ  ˜(Kšœ-žœMžœ}™ÿK˜—šœžœ˜1KšœžœžœX™gK˜—šŸœžœ˜Kšœ™K™—šŸœžœžœ˜8Kšœš™šK™—šŸœžœžœ˜4Kšœš™š—K˜KšŸœžœžœ˜.šŸœžœ&žœ˜XK˜šœç™çK˜——K˜Kšžœ˜K˜—…—  ·