-- DragonRealOps.mesa -- Last Modified: Stewart, August 27, 1982 11:03 am DIRECTORY Real USING [ExceptionFlags, UsualExceptions]; RealOps: CEDAR DEFINITIONS = BEGIN -- See IEEE floating point standard for more information. -- Modes -- rn: Round to nearest (unbiased). -- rz: Round to zero (truncate). -- rp: Round to plus infinity (round up). -- rm: Round to minus infinity (round down). RoundingMode: TYPE = MACHINE DEPENDENT{rn, rz, rm, rp}; DefaultRoundingMode: RoundingMode = rn; InfinityMode: TYPE = MACHINE DEPENDENT{projective, affine}; DefaultInfinityMode: InfinityMode = projective; -- Affine mode has two infinities (positive and negative). -- Projective mode has only one (unsigned). NormalizationMode: TYPE = MACHINE DEPENDENT{warning, normalizing}; DefaultNormalizationMode: NormalizationMode = warning; -- Warning mode recognizes operand's unnormalized character. -- Normalizing mode (internally) normalizes operands before operating on them. Mode: TYPE = MACHINE DEPENDENT RECORD [ blank(0:0..5): [0..77B] ← NULL, im(0:6..6): InfinityMode ← projective, nm(0:7..7): NormalizationMode ← warning, round(0:8..9): RoundingMode ← rn, traps(0:10..15): Real.ExceptionFlags ← Real.UsualExceptions]; DefMode: Mode = [blank: 0, im: projective, nm: warning, round: rn, traps: Real.UsualExceptions]; FixMode: Mode = [blank: 0, im: projective, nm: warning, round: rz, traps: Real.UsualExceptions]; -- The Mode applies only to operations called through this interface. SetMode: PROC [new: Mode] RETURNS [old: Mode]; GetMode: PROC RETURNS [Mode]; -- Operations FAdd: PROC [a, b: REAL, m: Mode ← DefMode] RETURNS [REAL]; FSub: PROC [a, b: REAL, m: Mode ← DefMode] RETURNS [REAL]; FMul: PROC [a, b: REAL, m: Mode ← DefMode] RETURNS [REAL]; FDiv: PROC [a, b: REAL, m: Mode ← DefMode] RETURNS [REAL]; FComp: PROC [a, b: REAL, m: Mode ← DefMode] RETURNS [INTEGER]; FRem: PROC [a, b: REAL, m: Mode ← DefMode] RETURNS [REAL]; Float: PROC [a: LONG INTEGER, m: Mode ← DefMode] RETURNS [REAL]; RoundLI: PROC [a: REAL, m: Mode ← DefMode] RETURNS [LONG INTEGER]; RoundI: PROC [a: REAL, m: Mode ← DefMode] RETURNS [INTEGER]; RoundC: PROC [a: REAL, m: Mode ← DefMode] RETURNS [CARDINAL]; FScale: PROC [a: REAL, scale: INTEGER, m: Mode ← DefMode] RETURNS [REAL]; SqRt: PROC [a: REAL, m: Mode ← DefMode] RETURNS [REAL]; InitReals: PROC; END. July 5, 1980 3:16 PM; Stewart, created September 28, 1980 8:06 PM; Stewart, Deleted individual mode procs. October 27, 1980 11:23 AM; Stewart, Fixed Mode type for LIB use. June 3, 1982 11:07 am; Stewart, added FScale, SqRt