program mathpak;
{(C) Australian Computer Society 1984}
{based on paper A Compact Mathematical Function Package
by A.P. Clarke and W. Marwood,
The Australian Computer Journal,
Vol 16, No 3, August 1984, pp 107 to 114
entered by W F McGee 1 Dec 1984}
const e=1.0e4;
sqrt_pi=1.772453850905;
sqrt2 =1.414213562373;
eul =0.577215664901;
sqrt12 =3.464101615137;
ln2 =0.693147180559;
ln10 =2.302585092994;
ln17 =2.833213344056;
TERMMAX=500;
type available=(sif,cif,e1f,jnf,mbif,lagf,qf,phif,erff,erfcf,
chgf2f,sxf,cxf,qmnf,pmnf,hf,gmf,hgff,chgf1f,ghgff,cf,sf,
expf,lf,l10f,done);
string25=string[25];
var prec:real;
numparm:array[available]of integer;
name:array[available]of string25;
sig_dig:integer;
sig_dig_flag:boolean;
sig_dig_real,Ubound,lngmb,gmb,mc_dig:real;
x:real;
{**********************************************************}
function lnn(x:real):real;
{natural log with zero exception}
begin
if x=0 then lnn:=-86 else lnn:=ln(x)
{IMPLEMENTATION DEPENDENT 38*ln10}
end;
{***********************************************************}
procedure sum_error(var1,dig1,var2,dig2:real);
var error:real;
begin
error:=abs(var1)*(exp(-dig1*ln10)+prec) +
abs(var2)*(exp(-dig2*ln10)+prec);
sig_dig:=trunc(ln(abs((var1+var2)/error))/ln10)
end;
{**************
|