Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
erfQ.cc
이 파일의 문서화 페이지로 가기
1 // $Id:$
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- erfQ ---
7 // method implementation file
8 // -----------------------------------------------------------------------
9 
10 // Contains methods that do not depend on large tables.
11 //
12 // erfQ (double x)
13 
14 // =======================================================================
15 // M Fischler - Created 1/26/00.
16 //
17 // =======================================================================
18 
19 #include "CLHEP/Random/Stat.h"
20 #include <cmath>
21 
22 namespace CLHEP {
23 
24 double HepStat::erfQ (double x) {
25 //
26 // erfQ is accurate to 7 places.
27 // See Numerical Recipes P 221
28 //
29 
30  double t, z, erfc;
31 
32  z = std::abs(x);
33  t = 1.0/(1.0+.5*z);
34 
35  erfc= t*std::exp(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+
36  t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+
37  t*(-0.82215223+t*0.17087277 ))) ))) )));
38 
39  // (The derivation of this formula should be obvious.)
40 
41  if ( x < 0 ) erfc = 2.0 - erfc;
42 
43  return 1 - erfc;
44 
45 }
46 
47 
48 } // namespace CLHEP
49 
Float_t x
Definition: compare.C:6
Double_t z
static double erfQ(double x)
Definition: erfQ.cc:24