{ (C) Copr. 1986-92 Numerical Recipes Software .5-28.} { Функция ошибок } unit uErf; interface function Erf(x:Double):Double; function Erfc(x:Double):Double; implementation USES uGamma; function Erf(x:Double):Double; begin if x<0 then erf:=-gammp(0.5, x*x) else erf:= gammp(0.5, x*x); end; function Erfc(x:Double):Double; var f,t,z:Double; begin z:=abs(x); t:=1./(1.+0.5*z); f:=t*exp(-z*z-1.26551223+ t*(1.00002368+ t*(0.37409196+ t*(0.09678418+ t*(-0.18628806+ t*(0.27886807+ t*(-1.13520398+ t*(1.48851587+ t*(-0.82215223+ t*0.17087277))))))))); if (x<0) then erfc:=2.-f else erfc:=f; end; END.