RealOps.mesa
Copyright Ó 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved.
Stewart, August 27, 1982 11:03 am
Russ Atkinson (RRA) November 17, 1986 11:18:07 am PST
Doug Wyatt, January 15, 1987 1:18:40 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(0), rz(1), rm(2), rp(3)};
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(0), affine(1)};
DefaultInfinityMode: InfinityMode = projective;
Affine mode has two infinities (positive and negative).
Projective mode has only one (unsigned).
NormalizationMode: TYPE = MACHINE DEPENDENT {warning(0), normalizing(1)};
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.
ModalFAdd: PROC [a, b: REAL, m: Mode ¬ DefMode] RETURNS [REAL];
ModalFSub: PROC [a, b: REAL, m: Mode ¬ DefMode] RETURNS [REAL];
ModalFMul: PROC [a, b: REAL, m: Mode ¬ DefMode] RETURNS [REAL];
ModalFDiv: PROC [a, b: REAL, m: Mode ¬ DefMode] RETURNS [REAL];
ModalFComp: PROC [a, b: REAL, m: Mode ¬ DefMode] RETURNS [INTEGER];
ModalFRem: PROC [a, b: REAL, m: Mode ¬ DefMode] RETURNS [REAL];
ModalFloat: PROC [a: LONG INTEGER, m: Mode ¬ DefMode] RETURNS [REAL];
ModalRound: PROC [a: REAL, m: Mode ¬ DefMode] RETURNS [INT];
ModalRoundI: PROC [a: REAL, m: Mode ¬ DefMode] RETURNS [INTEGER];
ModalRoundC: PROC [a: REAL, m: Mode ¬ DefMode] RETURNS [CARDINAL];
ModalFScale: 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