RealOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Stewart, August 27, 1982 11:03 am
Russ Atkinson (RRA) February 19, 1985 4:07:56 pm PST
Doug Wyatt, February 25, 1985 2:50:07 pm PST
DIRECTORY
Real USING [ExceptionFlags, UsualExceptions];
Defines the possible floating point modes, and operations that use them.
See IEEE floating point standard for more information.
RealOps: CEDAR DEFINITIONS
= BEGIN
RoundingMode: TYPE = MACHINE DEPENDENT {rn, rz, rm, rp};
DefaultRoundingMode: RoundingMode = rn;
rn: Round to nearest (unbiased).
rz: Round to zero (truncate).
rp: Round to plus infinity (round up).
rm: Round to minus infinity (round down).
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
];
SetMode: PROC [new: Mode] RETURNS [old: Mode];
GetMode:
PROC
RETURNS [Mode];
The Mode applies only to operations called through this interface.
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];
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