WeitekIeee:
DEFINITIONS
IMPORTS =
BEGIN OPEN PascalNoviceFiles, PascalBasic;
MantBits: PascalInteger = 112; --Max # of mantissa bits, any form
ExpBits: PascalInteger = 15; --Max # of exponent bits, any form
MaxNumBits: PascalInteger = 128; --1+exp𡤋its+mant𡤋its
MantBitsM1: PascalInteger = 111; --mant𡤋its-1
MantBitsP1: PascalInteger = 113; --mant𡤋its+1
MantBitsP2: PascalInteger = 114; --mant𡤋its+2
SingleExpBits: PascalInteger = 8; -- 3{4 Number of exponent bits, single
SingleMantBits: PascalInteger = 24; -- 3{5 Number of mantissa bits, single
SingleMinExp: PascalInteger =-126; -- -2{-6 Minimum exponent, single
SingleMaxExp: PascalInteger = 127; -- 3{7 Maximum exponent, single
SingleBias: PascalInteger = 127; -- 3{7 Bias, single
DoubleExpBits: PascalInteger = 11; --Number of exponent bits, double
DoubleMantBits: PascalInteger = 53; --Number of mantissa bits, double
DoubleMinExp: PascalInteger = -1022; --Minimum exponent, double
DoubleMaxExp: PascalInteger = 1023; --Maximum exponent, double
DoubleBias: PascalInteger = 1023; --Bias, double
ExtendedExpBits: PascalInteger = 15; --Number of exponent bits, extended
ExtendedMantBits: PascalInteger = 112; --Number of mantissa bits, extended
ExtendedMinExp: PascalInteger = -16383; --Minimum exponent, extended
ExtendedMaxExp: PascalInteger = 16383; --Maximum exponent, extended
ExtendedBias: PascalInteger = 16383; --Maximum exponent, extended
Nstringchars: PascalInteger = 30; --Max number of chars in a string
Debug: PascalBoolean = FALSE;
Bit: TYPE = PascalInteger [0..1];
Shortreal: TYPE = PACKED ARRAY PascalInteger [1..32] OF Bit;
Longreal: TYPE = PACKED ARRAY PascalInteger [1..64] OF Bit;
Verylongreal: TYPE = PACKED ARRAY PascalInteger [1..128] OF Bit; --extended prec, extern
MantArray: TYPE = PACKED ARRAY PascalInteger [1..MantBits] OF Bit; --mantissa
Number:
TYPE =
RECORD [
--Internal form used for all numbers
Sign: Bit,
Expon: PascalInteger, --unbiased
Mant: MantArray]; --with explicit leading bit
Formattype: TYPE = {Single, Double, Extended};
TrapSetting: TYPE = {Disabled, Enabled};
Undermodetype: TYPE = {Warning, Normalizing};
Infinitytype: TYPE = {Projective, Affine};
Roundtype: TYPE = {Rn, Rp, Rz, Rm};
Expbitstype: TYPE = PascalInteger [SingleExpBits..ExtendedExpBits];
ErrorIndicator: TYPE = {Off, On};
ErrorFlag: TYPE = ErrorIndicator;
String: TYPE = PACKED ARRAY PascalInteger [1..Nstringchars] OF PascalChar;
String5: TYPE = PACKED ARRAY PascalInteger [1..5] OF PascalChar; --for segment loader
Cc: TYPE = {Lt, Eq, Gt, Un}; --Condition Codes
Twooperandtype: TYPE = {A, B, C, D, E, F, G, H, I, X, Y, M};
Oneoperandtype: TYPE = {Pmzero, W, Pminf, Nan};
Modestype:
TYPE =
-- PACKED --
RECORD [
InvalidTrap: TrapSetting,
DivbyzeroTrap: TrapSetting,
OverflowTrap: TrapSetting,
UnderflowTrap: TrapSetting,
InexactTrap: TrapSetting,
CheckUnderflowBeforeRounding: PascalBoolean,
UnderMode: Undermodetype,
InfinityMode: Infinitytype,
RoundMode: Roundtype];
Indicstype:
TYPE =
-- PACKED --
RECORD [
DivbyzeroIndic: ErrorIndicator, --indics cleared
InvalidIndic: ErrorIndicator, --before each
OverflowIndic: ErrorIndicator, --operation
UnderflowIndic: ErrorIndicator,
InexactIndic: ErrorIndicator,
DivbyzeroFlag: ErrorFlag, --flags are
InvalidFlag: ErrorFlag, --sticky
OverflowFlag: ErrorFlag,
UnderflowFlag: ErrorFlag,
InexactFlag: ErrorFlag];
Gvarstype:
TYPE =
RECORD [
Format: Formattype,
MantPrec: PascalInteger [2..MantBits], --# of mantissa bits
MinExp: PascalInteger, --minimum exponent, unbiased
MaxExp: PascalInteger, --maximum exponent, unbiased
Bias: PascalInteger,
Expbits: Expbitstype, --# of exponent bits
Guard, Round, Sticky, Carry: Bit];
Access: TYPE = {A1, A2, A3, A4, A5, A6};
Pervert:
TYPE =
RECORD [
x1:
SELECT
OVERLAID Access
FROM
A1 => [I: PascalInteger],
A2 => [H1, H2, H3, H4: PascalInteger],
A3 => [R: Shortreal],
A4 => [L: Longreal],
A5 => [Vl: Verylongreal],
A6 => [B: PACKED ARRAY PascalInteger [1..MaxNumBits] OF Bit],
ENDCASE];
Fubar: Text;
Halt: PROCEDURE [HaltCode: PascalInteger];
Xor: PROCEDURE [A, B: Bit] RETURNS [XorResult: Bit]; --Exclusive OR
Zero:
PROCEDURE [
Result: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype];
Pluszero:
PROCEDURE [
Result: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype];
Minuszero:
PROCEDURE [
Result: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype];
Issignificandzero:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IssignificandzeroResult: PascalBoolean];
Iszero:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IszeroResult: PascalBoolean];
Isnormalzero:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsnormalzeroResult: PascalBoolean];
Isinfinity:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsinfinityResult: PascalBoolean];
Isnan:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsnanResult: PascalBoolean];
Istrappingnan:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IstrappingnanResult: PascalBoolean];
Isfinite:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsfiniteResult: PascalBoolean];
Issame:
PROCEDURE [
N1, N2: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IssameResult: PascalBoolean];
Isunnormalized:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsunnormalizedResult: PascalBoolean];
Isdenormalized:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsdenormalizedResult: PascalBoolean];
Isnormalized:
PROCEDURE [
N: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype]
RETURNS [IsnormalizedResult: PascalBoolean];
SetDivbyzero: PROCEDURE [Indics: LONG POINTER TO Indicstype];
SetInvalid: PROCEDURE [Indics: LONG POINTER TO Indicstype];
SetOverflow: PROCEDURE [Indics: LONG POINTER TO Indicstype];
SetUnderflow: PROCEDURE [Indics: LONG POINTER TO Indicstype];
SetInexact: PROCEDURE [Indics: LONG POINTER TO Indicstype];
UpdateFlags: PROCEDURE [Indics: LONG POINTER TO Indicstype];
Gettrappingnan:
PROCEDURE [
Result: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype];
Getnontrappingnan:
PROCEDURE [
Result: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype];
Getnan:
PROCEDURE [
Result: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Gvars: LONG POINTER TO Gvarstype];
Selectnan:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: LONG POINTER TO Number];
Plusinf:
PROCEDURE [
Result: LONG POINTER TO Number, Gvars: LONG POINTER TO Gvarstype];
Flmo:
PROCEDURE [
Op: LONG POINTER TO MantArray, Gvars: LONG POINTER TO Gvarstype]
RETURNS [FlmoResult: PascalInteger];
Oneoperandcase:
PROCEDURE [
Op: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype]
RETURNS [OneoperandcaseResult: Oneoperandtype];
Twooperandcase:
PROCEDURE [
Op1, Op2: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype]
RETURNS [TwooperandcaseResult: Twooperandtype];
Shftl:
PROCEDURE [
N: LONG POINTER TO Number, D: PascalInteger,
Gvars: LONG POINTER TO Gvarstype];
Shftr:
PROCEDURE [
N: LONG POINTER TO Number, D: PascalInteger,
Gvars: LONG POINTER TO Gvarstype];
Examine:
PROCEDURE [
N: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype, Gvars: LONG POINTER TO Gvarstype]
RETURNS [ExamineResult: PascalBoolean];
Roundnum:
PROCEDURE [
N: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype, Gvars: LONG POINTER TO Gvarstype]; --uses G,R,S
CheckUnderAndRound:
PROCEDURE [
N: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype, Gvars: LONG POINTER TO Gvarstype];
CheckInvAndOv:
PROCEDURE [
N: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype, Gvars: LONG POINTER TO Gvarstype];
Addsignificands:
PROCEDURE [
Result: LONG POINTER TO MantArray, Op1, Op2: LONG POINTER TO MantArray,
Gvars: LONG POINTER TO Gvarstype];
Addoperands:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Multsignificands:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Dividesignificands:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Pack:
PROCEDURE [
Result: LONG POINTER TO Pervert, N: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Packs:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Packd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Packe:
PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Number,
Gvars: LONG POINTER TO Gvarstype];
Unpack:
PROCEDURE [
Result: LONG POINTER TO Number, T1: LONG POINTER TO Pervert,
Gvars: LONG POINTER TO Gvarstype];
Unpacks:
PROCEDURE [
Result: LONG POINTER TO Number, N: LONG POINTER TO Shortreal,
Gvars: LONG POINTER TO Gvarstype];
Unpackd:
PROCEDURE [
Result: LONG POINTER TO Number, N: LONG POINTER TO Longreal,
Gvars: LONG POINTER TO Gvarstype];
Unpacke:
PROCEDURE [
Result: LONG POINTER TO Number, N: LONG POINTER TO Verylongreal,
Gvars: LONG POINTER TO Gvarstype];
Add:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Subtract:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Multiply:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Divide:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Remainder:
PROCEDURE [
Result: LONG POINTER TO Number, Op1, Op2: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Sqrtt:
PROCEDURE [
Result: LONG POINTER TO Number, Op: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Convert:
PROCEDURE [
Result: LONG POINTER TO Number, Restype: Formattype, Op: Number,
Optype: Formattype,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Integerize:
PROCEDURE [
Result: LONG POINTER TO Number, Op: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Bindec:
PROCEDURE [
Result: LONG POINTER TO String, Op: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Decbin:
PROCEDURE [
Result: LONG POINTER TO Number, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Compare:
PROCEDURE [
Result: LONG POINTER TO Cc, Op1, Op2: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype];
Resetig:
PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype];
Setsingle:
PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype];
Setdouble:
PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype];
Setextended:
PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype];
Adds:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Addd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Adde:
PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype];
Subs:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Subd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Sube:
PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype];
Muls:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Muld:
PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Mule:
PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype];
Divs:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Divd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Dive:
PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype];
Rems:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Remd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Reme:
PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype];
Sqrts:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Sqrtd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Sqrte:
PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Consd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Conse:
PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Conds:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Conde:
PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Cones:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Coned:
PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Ints:
PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Intd:
PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Inte:
PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Sbindec:
PROCEDURE [
Res: LONG POINTER TO String, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Dbindec:
PROCEDURE [
Res: LONG POINTER TO String, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Ebindec:
PROCEDURE [
Res: LONG POINTER TO String, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Sdecbin:
PROCEDURE [
Result: LONG POINTER TO Shortreal, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Ddecbin:
PROCEDURE [
Result: LONG POINTER TO Longreal, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Edecbin:
PROCEDURE [
Result: LONG POINTER TO Verylongreal, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype];
Scompare:
PROCEDURE [
Op1, Op2: LONG POINTER TO Shortreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] RETURNS [ScompareResult: Cc];
Dcompare:
PROCEDURE [
Op1, Op2: LONG POINTER TO Longreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] RETURNS [DcompareResult: Cc];
Ecompare:
PROCEDURE [
Op1, Op2: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype]
RETURNS [EcompareResult: Cc];
Error99: ERROR;
END.