7 !! Computation of the complementary error function erfc(x) = 1-erf(x)
8 !! with a fractional error everywhere less than 1.2 x 10^(-7)
9 !! (formula by Press et al., 'Numerical Recipes in Fortran 77').
13 !! Copyright 2009-2013 Reinhard Calov, Ralf Greve
17 !! This file is part of SICOPOLIS.
19 !! SICOPOLIS is free software: you can redistribute it and/or modify
20 !! it under the terms of the GNU General Public License as published by
21 !! the Free Software Foundation, either version 3 of the License, or
22 !! (at your option) any later version.
24 !! SICOPOLIS is distributed in the hope that it will be useful,
25 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
26 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 !! GNU General Public License for more details.
29 !! You should have received a copy of the GNU General Public License
30 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
32 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35 !> Computation of the complementary error function erfc(x) = 1-erf(x)
36 !! with a fractional error everywhere less than 1.2 x 10^(-7)
37 !! (formula by Press et al., 'Numerical Recipes in Fortran 77').
38 !<------------------------------------------------------------------------------
45 real(dp),
intent(in) :: x
50 t = 1.0_dp/(1.0_dp+0.5_dp*z)
52 erfcc = t * exp( -z*z -1.26551223_dp &
53 + t * ( 1.00002368_dp &
54 + t * ( 0.37409196_dp &
55 + t * ( 0.09678418_dp &
56 + t * ( -0.18628806_dp &
57 + t * ( 0.27886807_dp &
58 + t * ( -1.13520398_dp &
59 + t * ( 1.48851587_dp &
60 + t * ( -0.82215223_dp &
61 + t * 0.17087277_dp ) ) ) ) ) ) ) ) )