shr_spfn_mod Module



Explanation of machine-dependent constants

XMIN = the smallest positive floating-point number. XINF = the largest positive finite floating-point number. XNEG = the largest negative argument acceptable to ERFCX; the negative of the solution to the equation 2exp(xx) = XINF. XSMALL = argument below which erf(x) may be represented by 2x/sqrt(pi) and above which xx will not underflow. A conservative value is the largest machine number X such that 1.0 + X = 1.0 to machine precision. XBIG = largest argument acceptable to ERFC; solution to the equation: W(x) * (1-0.5/x2) = XMIN, where W(x) = exp(-xx)/[xsqrt(pi)]. XHUGE = argument above which 1.0 - 1/(2xx) = 1.0 to machine precision. A conservative value is 1/[2sqrt(XSMALL)] XMAX = largest acceptable argument to ERFCX; the minimum of XINF and 1/[sqrt(pi)XMIN].

Approximate values for some important machines are:

                      XMIN       XINF        XNEG     XSMALL

CDC 7600 (S.P.) 3.13E-294 1.26E+322 -27.220 7.11E-15 CRAY-1 (S.P.) 4.58E-2467 5.45E+2465 -75.345 7.11E-15 IEEE (IBM/XT, SUN, etc.) (S.P.) 1.18E-38 3.40E+38 -9.382 5.96E-8 IEEE (IBM/XT, SUN, etc.) (D.P.) 2.23D-308 1.79D+308 -26.628 1.11D-16 IBM 195 (D.P.) 5.40D-79 7.23E+75 -13.190 1.39D-17 UNIVAC 1108 (D.P.) 2.78D-309 8.98D+307 -26.615 1.73D-18 VAX D-Format (D.P.) 2.94D-39 1.70D+38 -9.345 1.39D-17 VAX G-Format (D.P.) 5.56D-309 8.98D+307 -26.615 1.11D-16

                      XBIG       XHUGE       XMAX

CDC 7600 (S.P.) 25.922 8.39E+6 1.80X+293 CRAY-1 (S.P.) 75.326 8.39E+6 5.45E+2465 IEEE (IBM/XT, SUN, etc.) (S.P.) 9.194 2.90E+3 4.79E+37 IEEE (IBM/XT, SUN, etc.) (D.P.) 26.543 6.71D+7 2.53D+307 IBM 195 (D.P.) 13.306 1.90D+8 7.23E+75 UNIVAC 1108 (D.P.) 26.582 5.37D+8 8.98D+307 VAX D-Format (D.P.) 9.269 1.90D+8 1.70D+38 VAX G-Format (D.P.) 26.569 6.71D+7 8.98D+307



Error returns

The program returns ERFC = 0 for ARG .GE. XBIG;

                   ERFCX = XINF  for  ARG .LT. XNEG;
  and
                   ERFCX = 0     for  ARG .GE. XMAX.

Intrinsic functions required are:

 ABS, AINT, EXP

Author: W. J. Cody Mathematics and Computer Science Division Argonne National Laboratory Argonne, IL 60439

Latest modification: March 19, 1990


Incomplete Gamma function

@author Tianyi Fan @version August-2010



Interfaces

public interface shr_spfn_erf

  • private function shr_spfn_erf_r4(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r4), intent(in) :: x

    Return Value real(kind=r4)

  • private function shr_spfn_erf_r8(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r8), intent(in) :: x

    Return Value real(kind=r8)

public interface shr_spfn_erfc

  • private function shr_spfn_erfc_r4(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r4), intent(in) :: x

    Return Value real(kind=r4)

  • private function shr_spfn_erfc_r8(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r8), intent(in) :: x

    Return Value real(kind=r8)

public interface shr_spfn_erfc_scaled

  • private function shr_spfn_erfc_scaled_r4(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r4), intent(in) :: x

    Return Value real(kind=r4)

  • private function shr_spfn_erfc_scaled_r8(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r8), intent(in) :: x

    Return Value real(kind=r8)

public interface shr_spfn_gamma

  • private elemental function shr_spfn_gamma_r8(x) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=r8), intent(in) :: x

    Return Value real(kind=r8)


Functions

public elemental function shr_spfn_igamma(a, x)

Arguments

Type IntentOptional Attributes Name
real(kind=r8), intent(in) :: a
real(kind=r8), intent(in) :: x

Return Value real(kind=r8)