FloatOps.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Bryan Lyles September 27, 1988 9:04:10 am PDT
Willie-s, August 6, 1991 12:47 pm PDT
DIRECTORY
Basics;
FloatOps: CEDAR DEFINITIONS
~ BEGIN
checking: BOOL = FALSE;
princOps: BOOL = BITS[WORD] = 16;
signStart: NAT = IF princOps THEN 16 ELSE 0;
signEnd: NAT = signStart;
expStart: NAT = signEnd+1;
expEnd: NAT = expStart+BITS[ExpRange]-1;
m1Start: NAT = expEnd+1;
m1End: NAT = m1Start+6;
m2Start: NAT = IF princOps THEN 0 ELSE 16;
m2End: NAT = m2Start+15;
ExpRange: TYPE = [0..377B];
nanExpon: ExpRange = ExpRange.LAST;
maxExpon: ExpRange = nanExpon.PRED;
hiddenBit: Float = [m2: 0, sign: FALSE, exp: 1, m1: 0];
hiddenBitAsCard: CARD32 = LOOPHOLE[hiddenBit, CARD32];
signBit: Float = [m2: 0, sign: TRUE, exp: 0, m1: 0];
signBitAsCard: CARD32 = LOOPHOLE[signBit, CARD32];
maxExponDelta: ExpRange = 24;
expBias: NAT = 127;
Float: TYPE = MACHINE DEPENDENT RECORD [
sign (0: signStart..signEnd): BOOL,
exp (0: expStart..expEnd): ExpRange,
m1 (0: m1Start..m1End): [0..177B],
m2 (0: m2Start..m2End): CARD16];
SoftSub: PROC [r0, r1: Float] RETURNS [Float];
SoftAdd: PROC [r0, r1: Float] RETURNS [Float];
SoftMul: PROC [r0, r1: Float] RETURNS [Float];
SoftDiv: PROC [r0, r1: Float] RETURNS [Float];
FloatInt: PROC [i: INT32] RETURNS [Float];
FloatCard: PROC [c: CARD32] RETURNS [Float];
SoftFix: PROC [c: Float] RETURNS [INT32];
SoftRnd: PROC [c: Float] RETURNS [INT32];
SoftFloor: PROC [c: REAL] RETURNS [INT32];
SoftCeiling: PROC [c: REAL] RETURNS [INT32];
SoftNeg: PROC [a: Float] RETURNS [Float];
SoftAbs: PROC [a: Float] RETURNS [Float];
RealMin: PROC [a, b: Float] RETURNS [Float];
RealMax: PROC [a, b: Float] RETURNS [Float];
SoftGt: PROC [r0, r1: Float] RETURNS [BOOL];
SoftGe: PROC [r0, r1: Float] RETURNS [BOOL];
SoftEq: PROC [r0, r1: Float] RETURNS [BOOL];
SoftCmp: PROC [r0, r1: Float] RETURNS [Basics.PartialComparison];
SoftLt: PROC [r0, r1: Float] RETURNS [BOOL];
SoftLe: PROC [r0, r1: Float] RETURNS [BOOL];
SignedPwr: PROC [base, exp: INT32] RETURNS [INT32];
UnsignedPwr: PROC [base, exp: CARD32] RETURNS [CARD32];
RealPwr: PROC [base, exp: REAL32] RETURNS [REAL32];
END.