WeitekIeeeImplB.mesa
Pascal-to-Mesa translator output, translated at June 19, 1984 4:05:37 pm PDT
Last Modified by Curry - June 20, 1984 2:17:53 pm PDT
DIRECTORY
PascalBasic,
PascalNoviceFiles,
WeitekIeee;
WeitekIeeeImplB: PROGRAM
IMPORTS PascalBasic, PascalNoviceFiles, WeitekIeee
EXPORTS WeitekIeee = PUBLIC
BEGIN OPEN PascalBasic, PascalNoviceFiles, WeitekIeee;
Fubar: Text ← [baseFile: PascalInventFileName["Fubar"]];
SetDivbyzero: PROCEDURE [Indics: LONG POINTER TO Indicstype] =
{Indics^.DivbyzeroIndic ← On};
SetInvalid: PROCEDURE [Indics: LONG POINTER TO Indicstype] =
{Indics^.InvalidIndic ← On};
SetOverflow: PROCEDURE [Indics: LONG POINTER TO Indicstype] =
{Indics^.OverflowIndic ← On};
SetUnderflow: PROCEDURE [Indics: LONG POINTER TO Indicstype] =
{Indics^.UnderflowIndic ← On};
SetInexact: PROCEDURE [Indics: LONG POINTER TO Indicstype] =
{Indics^.InexactIndic ← On};
UpdateFlags: PROCEDURE [Indics: LONG POINTER TO Indicstype] = {
OPEN Indics^;
IF InvalidIndic = On THEN {
InvalidFlag ← On;
InexactIndic ← Off}; --invalid masks inexact
IF DivbyzeroIndic = On THEN DivbyzeroFlag ← On;
IF OverflowIndic = On THEN OverflowFlag ← On;
IF UnderflowIndic = On THEN UnderflowFlag ← On;
IF InexactIndic = On THEN InexactFlag ← On};
check underflow and round
CheckUnderAndRound: PROCEDURE [
N: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype, Gvars: LONG POINTER TO Gvarstype] = {
OPEN N^, Modes^, Indics^, Gvars^;
I, K: PascalInteger;
Unroundedn: Number;
Oldgvars: Gvarstype;
Oldgvars ← Gvars^;
Unroundedn ← N^;
IF NOT CheckUnderflowBeforeRounding THEN
Roundnum[@N^, @Modes^, @Indics^, @Gvars^];
IF Expon < MinExp THEN --BUG: what if unnormalized prod indisting from
IF UnderflowTrap = Enabled --normal zero?
THEN {
SetUnderflow[@Indics^];
SELECT Format FROM
Single => Expon ← Expon + 192 - Bias; --Kludge, pack will add
Double => Expon ← Expon + 1536 - Bias; --in the bias
Extended => {
K ← 1;
FOR i: INT IN [INT[1]..INT[MantPrec - 2]] DO I ← i; KK*2 ENDLOOP;
Expon ← Expon + K - Bias};
ENDCASE}
ELSE {
SetUnderflow[@Indics^];
IF NOT CheckUnderflowBeforeRounding THEN {
N^ ← Unroundedn; --avoid double rounding
Gvars^ ← Oldgvars}; --restore possible flags g by rounding
Shftr[@N^, MinExp - Expon, @Gvars^];
Expon ← MinExp;
IF NOT CheckUnderflowBeforeRounding THEN
Roundnum[@N^, @Modes^, @Indics^, @Gvars^]}; --must re-round
IF CheckUnderflowBeforeRounding THEN
Roundnum[@N^, @Modes^, @Indics^, @Gvars^]};
CheckInvAndOv: PROCEDURE [
N: LONG POINTER TO Number, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype, Gvars: LONG POINTER TO Gvarstype] = {
OPEN N^, Modes^, Indics^, Gvars^;
S: Bit;
I: PascalInteger [1..MantBits];
K, J: PascalInteger;
IF Isunnormalized[@N^, @Gvars^] AND (NOT Isdenormalized[@N^, @Gvars^])
AND ((Format = Single) OR (Format = Double))
THEN {SetInvalid[@Indics^]; Getnan[@N^, @Modes^, @Gvars^]}
ELSE {
OPEN N^;
IF Expon > MaxExp THEN SELECT OverflowTrap FROM
Enabled => {
SetOverflow[@Indics^];
SELECT Format FROM
Single => Expon ← Expon - 192 - Bias; --Kludge,
Double => Expon ← Expon - 1536 - Bias; --pack wil
Extended => { --add in
K ← 1; --the bias
FOR i: INT IN [INT[1]..INT[MantPrec - 2]] DO
J ← i; KK*2 ENDLOOP;
Expon ← Expon - 3*K - Bias};
ENDCASE };
Disabled => {
SetOverflow[@Indics^];
SetInexact[@Indics^];
IF ((RoundMode = Rm) AND (Sign = 0))
OR ((RoundMode = Rz) AND (Sign = 0))
OR ((RoundMode = Rp) AND (Sign = 1))
OR ((RoundMode = Rz) AND (Sign = 1))
THEN {
IF Isnormalized[@N^, @Gvars^] THEN
FOR i: INT IN [INT[1]..INT[MantPrec]] DO
I ← i; Mant[I] ← 1 ENDLOOP;
Expon ← MaxExp}
ELSE {S ← Sign; Plusinf[@N^, @Gvars^]; Sign ← S} };
ENDCASE} };
Sqrtt: PROCEDURE [
Result: LONG POINTER TO Number, Op: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype] = {
IF Examine[@Op, @Modes^, @Indics^, @Gvars^] THEN {
OPEN Modes^, Indics^, Gvars^;
SELECT Oneoperandcase[@Op, @Gvars^] FROM
Pmzero => Result^ ← Op; --bugs - incomplete
Pminf => IF (Op.Sign = 1) OR (InfinityMode = Projective)
THEN {SetInvalid[@Indics^]; Getnan[@Result^, @Modes^, @Gvars^]; }
ELSE Result^ ← Op;
W => --writeln('Not yet')-- Halt[5];
Nan => Result^ ← Op;
ENDCASE}
ELSE Getnan[@Result^, @Modes^, @Gvars^]};
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] = {Halt[6]};
writeln('CONVERT not yet implemented') bugs - incomplete
Integerize: PROCEDURE [
Result: LONG POINTER TO Number, Op: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype] = {
Shiftdist: PascalInteger;
IF Examine[@Op, @Modes^, @Indics^, @Gvars^]
THEN {
OPEN Modes^, Indics^, Gvars^;
SELECT Oneoperandcase[@Op, @Gvars^] FROM
Pmzero => Result^ ← Op;
Pminf => Result^ ← Op;
W => {
OPEN Op;
IF Expon >= MantPrec - 1
THEN Result^ ← Op
ELSE {
--1-- Shftr[@Op, MantPrec - 1 - Expon, @Gvars^];
Expon ← MantPrec - 1;
--2-- Result^ ← Op;
Roundnum[@Result^, @Modes^, @Indics^, @Gvars^];
Guard ← 0;
Round ← 0;
Sticky ← 0;
3--
IF Issignificandzero[@Result^, @Gvars^]
THEN Result^.Expon ← MinExp
ELSE
{
Shiftdist ← Flmo[@Result^.Mant, @Gvars^];
Shftl[@Result^, Shiftdist, @Gvars^];
Result^.Expon ← Result^.Expon - Shiftdist} } };
Nan => Result^ ← Op;
ENDCASE}
ELSE Getnan[@Result^, @Modes^, @Gvars^]};
Bindec: PROCEDURE [
Result: LONG POINTER TO String, Op: Number,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype,
Gvars: LONG POINTER TO Gvarstype] = {Halt[7]};
writeln('BINDEC not yet implemented') bugs - incomplete
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] = {Halt[8]};
writeln('DECBIN not yet implemented') bugs - incomplete
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] = {
OPEN Modes^;
I: PascalInteger;
Unordered cases
IF (Isnan[@Op1, @Gvars^] OR Isnan[@Op2, @Gvars^])
OR ((InfinityMode = Projective)
AND ((Isinfinity[@Op2, @Gvars^] AND Isfinite[@Op1, @Gvars^])
OR (Isinfinity[@Op1, @Gvars^] AND Isfinite[@Op2, @Gvars^])))
THEN Result^ ← Un
Special (sign independent) Equal cases
ELSE IF (InfinityMode = Projective) AND (Isinfinity[@Op1, @Gvars^])
AND (Isinfinity[@Op2, @Gvars^])
THEN Result^ ← Eq
ELSE IF Iszero[@Op1, @Gvars^] AND Iszero[@Op2, @Gvars^]
THEN Result^ ← Eq
Equal case
ELSE IF (Issame[@Op1, @Op2, @Gvars^])
THEN Result^ ← Eq
Bit compare necessary
ELSE IF Op1.Sign # Op2.Sign
THEN IF Op1.Sign = 0
THEN Result^ ← Gt ELSE Result^ ← Lt
ELSE IF Op1.Expon # Op2.Expon
THEN {IF ((Op1.Expon > Op2.Expon) AND (Op1.Sign = 0))
OR ((Op1.Expon < Op2.Expon) AND (Op1.Sign = 1))
THEN Result^ ← Gt
ELSE Result^ ← Lt}
ELSE { --mantissa check necessary
I ← 1;
WHILE (I <= Gvars^.MantPrec) AND (Op1.Mant[I] = Op2.Mant[I])
DO II + 1 ENDLOOP;
IF I > Gvars^.MantPrec
THEN Halt[9] --were equal, tested above
ELSE IF ((Op1.Mant[I] = 1) AND (Op1.Sign = 0))
OR ((Op1.Mant[I] = 0) AND (Op1.Sign = 1))
THEN Result^ ← Gt
ELSE Result^ ← Lt} };
Resetig: PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype] = {
OPEN Gvars^, Indics^;
Guard  ← 0;
Round ← 0;
Sticky  ← 0;
Carry  ← 0;
InvalidIndic  ← Off;
DivbyzeroIndic ← Off;
OverflowIndic ← Off;
UnderflowIndic ← Off;
InexactIndic  ← Off};
Setsingle: PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype] = {
OPEN Gvars^;
Format ← Single;
Expbits ← SingleExpBits;
MantPrec ← SingleMantBits;
MinExp ← SingleMinExp;
MaxExp ← SingleMaxExp;
Bias ← SingleBias};
Setdouble: PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype] = {
OPEN Gvars^;
Format ← Double;
Expbits ← DoubleExpBits;
MantPrec ← DoubleMantBits;
MinExp ← DoubleMinExp;
MaxExp ← DoubleMaxExp;
Bias ← DoubleBias};
SetExtended: PROCEDURE [
Gvars: LONG POINTER TO Gvarstype, Indics: LONG POINTER TO Indicstype] = {
OPEN Gvars^;
Format ← Extended;
Expbits ← ExtendedExpBits;
MantPrec ← ExtendedMantBits;
MinExp ← ExtendedMinExp;
MaxExp ← ExtendedMaxExp;
Bias ← ExtendedBias};
Adds: PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@N1Unpacked, @N1^, @Gvars];
Unpacks[@N2Unpacked, @N2^, @Gvars];
Add[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Addd: PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@N1Unpacked, @N1^, @Gvars];
Unpackd[@N2Unpacked, @N2^, @Gvars];
Add[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Adde: PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@N1Unpacked, @N1^, @Gvars];
Unpacke[@N2Unpacked, @N2^, @Gvars];
Add[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Subs: PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@N1Unpacked, @N1^, @Gvars];
Unpacks[@N2Unpacked, @N2^, @Gvars];
Subtract[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Subd: PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@N1Unpacked, @N1^, @Gvars];
Unpackd[@N2Unpacked, @N2^, @Gvars];
Subtract[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Sube: PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@N1Unpacked, @N1^, @Gvars];
Unpacke[@N2Unpacked, @N2^, @Gvars];
Subtract[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Muls: PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@N1Unpacked, @N1^, @Gvars];
Unpacks[@N2Unpacked, @N2^, @Gvars];
Multiply[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Muld: PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@N1Unpacked, @N1^, @Gvars];
Unpackd[@N2Unpacked, @N2^, @Gvars];
Multiply[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Mule: PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@N1Unpacked, @N1^, @Gvars];
Unpacke[@N2Unpacked, @N2^, @Gvars];
Multiply[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Divs: PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@N1Unpacked, @N1^, @Gvars];
Unpacks[@N2Unpacked, @N2^, @Gvars];
Divide[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Divd: PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@N1Unpacked, @N1^, @Gvars];
Unpackd[@N2Unpacked, @N2^, @Gvars];
Divide[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Dive: PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@N1Unpacked, @N1^, @Gvars];
Unpacke[@N2Unpacked, @N2^, @Gvars];
Divide[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Rems: PROCEDURE [
Result: LONG POINTER TO Shortreal, N1, N2: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@N1Unpacked, @N1^, @Gvars];
Unpacks[@N2Unpacked, @N2^, @Gvars];
Remainder[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Remd: PROCEDURE [
Result: LONG POINTER TO Longreal, N1, N2: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@N1Unpacked, @N1^, @Gvars];
Unpackd[@N2Unpacked, @N2^, @Gvars];
Remainder[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Reme: PROCEDURE [
Result: LONG POINTER TO Verylongreal,
N1, N2: LONG POINTER TO Verylongreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
N1Unpacked, N2Unpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@N1Unpacked, @N1^, @Gvars];
Unpacke[@N2Unpacked, @N2^, @Gvars];
Remainder[@Res, N1Unpacked, N2Unpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Sqrts: PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@NUnpacked, @N^, @Gvars];
Sqrtt[@Res, NUnpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Sqrtd: PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@NUnpacked, @N^, @Gvars];
Sqrtt[@Res, NUnpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Sqrte: PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@NUnpacked, @N^, @Gvars];
Sqrtt[@Res, NUnpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Consd: PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@NUnpacked, @N^, @Gvars];
Convert[@Res, Double, NUnpacked, Single, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Conse: PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@NUnpacked, @N^, @Gvars];
Convert[@Res, Extended, NUnpacked, Single, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Conds: PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@NUnpacked, @N^, @Gvars];
Convert[@Res, Single, NUnpacked, Double, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Conde: PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@NUnpacked, @N^, @Gvars];
Convert[@Res, Extended, NUnpacked, Double, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Cones: PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@NUnpacked, @N^, @Gvars];
Convert[@Res, Single, NUnpacked, Extended, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Coned: PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@NUnpacked, @N^, @Gvars];
Convert[@Res, Double, NUnpacked, Extended, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Ints: PROCEDURE [
Result: LONG POINTER TO Shortreal, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@NUnpacked, @N^, @Gvars];
Integerize[@Res, NUnpacked, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Intd: PROCEDURE [
Result: LONG POINTER TO Longreal, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@NUnpacked, @N^, @Gvars];
Integerize[@Res, NUnpacked, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Inte: PROCEDURE [
Result: LONG POINTER TO Verylongreal, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Res: Number;
Gvars: Gvarstype;
NUnpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@NUnpacked, @N^, @Gvars];
Integerize[@Res, NUnpacked, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Sbindec: PROCEDURE [
Res: LONG POINTER TO String, N: LONG POINTER TO Shortreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Gvars: Gvarstype;
NUnpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@NUnpacked, @N^, @Gvars];
Bindec[@Res^, NUnpacked, @Modes^, @Indics^, @Gvars];
UpdateFlags[@Indics^]};
Dbindec: PROCEDURE [
Res: LONG POINTER TO String, N: LONG POINTER TO Longreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Gvars: Gvarstype;
NUnpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@NUnpacked, @N^, @Gvars];
Bindec[@Res^, NUnpacked, @Modes^, @Indics^, @Gvars];
UpdateFlags[@Indics^]};
Ebindec: PROCEDURE [
Res: LONG POINTER TO String, N: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Gvars: Gvarstype;
NUnpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@NUnpacked, @N^, @Gvars];
Bindec[@Res^, NUnpacked, @Modes^, @Indics^, @Gvars];
UpdateFlags[@Indics^]};
Sdecbin: PROCEDURE [
Result: LONG POINTER TO Shortreal, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Gvars: Gvarstype;
Res: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Decbin[@Res, @Op^, @Modes^, @Indics^, @Gvars];
Packs[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Ddecbin: PROCEDURE [
Result: LONG POINTER TO Longreal, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Gvars: Gvarstype;
Res: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Decbin[@Res, @Op^, @Modes^, @Indics^, @Gvars];
Packd[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Edecbin: PROCEDURE [
Result: LONG POINTER TO Verylongreal, Op: LONG POINTER TO String,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype] = {
Gvars: Gvarstype;
Res: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Decbin[@Res, @Op^, @Modes^, @Indics^, @Gvars];
Packe[@Result^, @Res, @Gvars];
UpdateFlags[@Indics^]};
Scompare: PROCEDURE [
Op1, Op2: LONG POINTER TO Shortreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] RETURNS [ScompareResult: Cc] = {
Res: Cc;
Gvars: Gvarstype;
Op1Unpacked, Op2Unpacked: Number;
Setsingle[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacks[@Op1Unpacked, @Op1^, @Gvars];
Unpacks[@Op2Unpacked, @Op1^, @Gvars];
Compare[@Res, Op1Unpacked, Op2Unpacked, @Modes^, @Indics^, @Gvars];
ScompareResult ← Res;
UpdateFlags[@Indics^]};
Dcompare: PROCEDURE [
Op1, Op2: LONG POINTER TO Longreal, Modes: LONG POINTER TO Modestype,
Indics: LONG POINTER TO Indicstype] RETURNS [DcompareResult: Cc] = {
Res: Cc;
Gvars: Gvarstype;
Op1Unpacked, Op2Unpacked: Number;
Setdouble[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpackd[@Op1Unpacked, @Op1^, @Gvars];
Unpackd[@Op2Unpacked, @Op1^, @Gvars];
Compare[@Res, Op1Unpacked, Op2Unpacked, @Modes^, @Indics^, @Gvars];
DcompareResult ← Res;
UpdateFlags[@Indics^]};
Ecompare: PROCEDURE [
Op1, Op2: LONG POINTER TO Verylongreal,
Modes: LONG POINTER TO Modestype, Indics: LONG POINTER TO Indicstype]
RETURNS [EcompareResult: Cc] = {
Res: Cc;
Gvars: Gvarstype;
Op1Unpacked, Op2Unpacked: Number;
SetExtended[@Gvars, @Indics^];
Resetig[@Gvars, @Indics^];
Unpacke[@Op1Unpacked, @Op1^, @Gvars];
Unpacke[@Op2Unpacked, @Op1^, @Gvars];
Compare[@Res, Op1Unpacked, Op2Unpacked, @Modes^, @Indics^, @Gvars];
EcompareResult ← Res;
UpdateFlags[@Indics^]};
main procedure
Error99: ERROR = CODE;
WeitekRun: UnsafeCommandProc = {
ENABLE Error99 => GOTO Label99;
EXITS Label99 => NULL };
PascalRegister["Weitek", WeitekRun];
END.