<<>> <> <> <> <<>> <> 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.