FUNCTION imhofbd(lambda:realarray; mult:posintarray; delta:realarray; noterms:units; epsl,eps2:real; VAR ifault:nonnegint):real; (Algorithm AS 256.1 Appl. Statist. (1990) Vol.39, No.2} tPascal translation of Koerts and Abrahamse's procedure for evaluating Imhof's upper bound) CONST pi=3.14159265;
 VAR i:units;
         count,hold,range,suml,sum2:real; 
BEGIN
 IF (noterms < 1) OR (epsl <= 0.0) OR (eps2 <= 0.0) THEN 
BEGIN ifault := 2; imhofbd := -2.0 END 
ELSE
 BEGIN
 count 0.0;
 suml 0.0; sum2 := 0.0; 
FOR i 1 TO noterms DO BEGIN hold := abs(lambda[i]); 
IF hold > eps2 THEN 
BEGIN
 count:= count+mult[i]; 
suml:= suml+mult[i]*ln(hold); 
END; 
sum2 := sum2+delta[i]
 END; 
IF count < 0.9 THEN
 BEGIN 
ifault := 4;
 imhofbd := -4.0
 END