11#if defined __cplusplus
20#define EULER 0.57721566490153286
31 double a, b, c, d, del, fact, h, psi;
39 if( ( n < 0 ) || ( x < 0.0 ) || ( ( x == 0.0 ) && ( ( n == 0 ) || ( n == 1 ) ) ) ) {
43 ans =
G4Exp( -x ) / x; }
51 for( i = 1; i <=
MAXIT; i++ ) {
54 d = 1.0 / ( a * d + b );
58 if( fabs( del - 1.0 ) <
EPS )
return( h *
G4Exp( -x ) );
62 ans = ( nm1 != 0 ) ? 1.0 / nm1 : -
G4Log(x) -
EULER;
64 for( i = 1; i <=
MAXIT; i++ ) {
67 del = -fact / ( i - nm1 ); }
70 for( ii = 1; ii <= nm1; ii++ ) psi += 1.0 / ii;
71 del = fact * ( -
G4Log( x ) + psi );
74 if( fabs( del ) < fabs( ans ) *
EPS )
return( ans );
82#if defined __cplusplus
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
double nf_exponentialIntegral(int n, double x, nfu_status *status)
enum nfu_status_e nfu_status