ERFC(3) - [MATHEMATICS] Complementary error function
result = erfc(x)
elemental real(kind=KIND) function erfc(x)real(kind=KIND),intent(in) :: x
o X is of type real and any valid kind o KIND is any value valid for type real o the result has the same characteristics as X
ERFC(3) computes the complementary error function of X. Simply put this is equivalent to 1 - ERF(X), but ERFC is provided because of the extreme loss of relative accuracy if ERF(X) is called for large X and the result is subtracted from 1.
ERFC(X) is defined as
$$ \text{erfc}(x) = 1 - \text{erf}(x) = 1 - \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2} dt. $$
o X : The type shall be real.
The return value is of type real and of the same kind as X. It lies in the range
0 <= erfc(x) <= 2.
and is a processor-dependent approximation to the complementary error function of X ( 1-ERF(X) ).
Sample program:
program demo_erfc use, intrinsic :: iso_fortran_env, only : real32, real64, real128 implicit none real(kind=real64) :: x = 0.17_real64 write(*,(*(g0)))X=,x, ERFC(X)=,erfc(x) write(*,(*(g0)))equivalently 1-ERF(X)=,1-erf(x) end program demo_erfcResults:
> X=.1700000000000000 ERFC(X)=.8100075387981912 > equivalently 1-ERF(X)=.8100075387981912
Fortran 2008
ERF(3) ERF_SCALED(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
o Wikipedia:error function
Nemo Release 3.1 | erfc (3fortran) | November 02, 2024 |