Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Namespaces | Functions | Variables
G4Exp.hh File Reference
#include <limits>
#include <stdint.h>
#include "G4Types.hh"

Go to the source code of this file.

Data Structures

union  G4ExpConsts::ieee754
 

Namespaces

 G4ExpConsts
 

Functions

G4double G4ExpConsts::uint642dp (uint64_t ll)
 
G4float G4ExpConsts::uint322sp (G4int x)
 
uint32_t G4ExpConsts::sp2uint32 (G4float x)
 
G4double G4ExpConsts::fpfloor (const G4double x)
 
G4float G4ExpConsts::fpfloor (const G4float x)
 
G4double G4Exp (G4double initial_x)
 Exponential Function double precision. More...
 
G4float G4Expf (G4float initial_x)
 Exponential Function single precision. More...
 
void expv (const uint32_t size, G4double const *__restrict__ iarray, G4double *__restrict__ oarray)
 
void G4Expv (const uint32_t size, G4double const *__restrict__ iarray, G4double *__restrict__ oarray)
 
void expfv (const uint32_t size, G4float const *__restrict__ iarray, G4float *__restrict__ oarray)
 
void G4Expfv (const uint32_t size, G4float const *__restrict__ iarray, G4float *__restrict__ oarray)
 

Variables

const G4double G4ExpConsts::EXP_LIMIT = 708
 
const G4double G4ExpConsts::PX1exp = 1.26177193074810590878E-4
 
const G4double G4ExpConsts::PX2exp = 3.02994407707441961300E-2
 
const G4double G4ExpConsts::PX3exp = 9.99999999999999999910E-1
 
const G4double G4ExpConsts::QX1exp = 3.00198505138664455042E-6
 
const G4double G4ExpConsts::QX2exp = 2.52448340349684104192E-3
 
const G4double G4ExpConsts::QX3exp = 2.27265548208155028766E-1
 
const G4double G4ExpConsts::QX4exp = 2.00000000000000000009E0
 
const G4double G4ExpConsts::LOG2E = 1.4426950408889634073599
 
const G4float G4ExpConsts::MAXLOGF = 88.72283905206835f
 
const G4float G4ExpConsts::MINLOGF = -88.f
 
const G4float G4ExpConsts::C1F = 0.693359375f
 
const G4float G4ExpConsts::C2F = -2.12194440e-4f
 
const G4float G4ExpConsts::PX1expf = 1.9875691500E-4f
 
const G4float G4ExpConsts::PX2expf =1.3981999507E-3f
 
const G4float G4ExpConsts::PX3expf =8.3334519073E-3f
 
const G4float G4ExpConsts::PX4expf =4.1665795894E-2f
 
const G4float G4ExpConsts::PX5expf =1.6666665459E-1f
 
const G4float G4ExpConsts::PX6expf =5.0000001201E-1f
 
const G4float G4ExpConsts::LOG2EF = 1.44269504088896341f
 

Function Documentation

void expfv ( const uint32_t  size,
G4float const *__restrict__  iarray,
G4float *__restrict__  oarray 
)
void expv ( const uint32_t  size,
G4double const *__restrict__  iarray,
G4double *__restrict__  oarray 
)
G4double G4Exp ( G4double  initial_x)
inline

Exponential Function double precision.

Definition at line 180 of file G4Exp.hh.

References G4ExpConsts::EXP_LIMIT, G4ExpConsts::fpfloor(), G4ExpConsts::LOG2E, n, G4ExpConsts::PX1exp, G4ExpConsts::PX2exp, G4ExpConsts::PX3exp, G4ExpConsts::QX1exp, G4ExpConsts::QX2exp, G4ExpConsts::QX3exp, G4ExpConsts::QX4exp, G4ExpConsts::uint642dp(), and test::x.

Referenced by G4PairProductionRelModel::CalcLPMFunctions(), G4NucleiModel::choosePointAlongTraj(), G4KleinNishinaCompton::ComputeCrossSectionPerAtom(), G4KleinNishinaModel::ComputeCrossSectionPerAtom(), G4MuBetheBlochModel::ComputeCrossSectionPerElectron(), G4MuBetheBlochModel::ComputeDEDXPerVolume(), G4hPairProductionModel::ComputeDMicroscopicCrossSection(), G4MuPairProductionModel::ComputeDMicroscopicCrossSection(), G4LivermoreBremsstrahlungModel::ComputeDXSectionPerAtom(), G4SeltzerBergerModel::ComputeDXSectionPerAtom(), G4WentzelVIModel::ComputeGeomPathLength(), G4WentzelVIRelModel::ComputeGeomPathLength(), G4GoudsmitSaundersonMscModel::ComputeGeomPathLength(), G4UrbanMscModel::ComputeGeomPathLength(), G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(), G4MuPairProductionModel::ComputeMicroscopicCrossSection(), G4GoudsmitSaundersonMscModel::ComputeTrueStepLength(), G4UrbanMscModel::ComputeTrueStepLength(), G4MuPairProductionModel::ComputMuPairLoss(), G4EquilibriumEvaporator::deExcite(), G4PreCompoundModel::DeExcite(), G4ionEffectiveCharge::EffectiveCharge(), G4Pow::expA(), G4NucleiModel::fillZoneRadii(), G4InuclSpecialFunctions::G4cbrt(), G4PhysicsLnVector::G4PhysicsLnVector(), G4PhysicsLogVector::G4PhysicsLogVector(), G4Poisson(), G4WentzelOKandVIxSection::G4WentzelOKandVIxSection(), G4NucleiModel::generateInteractionLength(), G4PreCompoundProton::GetOpt2(), G4PreCompoundProton::GetOpt3(), G4NucleiModel::initializeCascad(), G4DipBustGenerator::PolarAngle(), G4DipBustGenerator::SampleDirection(), G4RayleighAngularGenerator::SampleDirection(), G4UniversalFluctuation::SampleFluctuations(), G4WentzelVIRelModel::SampleScattering(), G4WentzelVIModel::SampleScattering(), G4GoudsmitSaundersonMscModel::SampleScattering(), G4LivermoreGammaConversionModel::SampleSecondaries(), G4LivermoreComptonModel::SampleSecondaries(), G4SeltzerBergerModel::SampleSecondaries(), G4LivermoreBremsstrahlungModel::SampleSecondaries(), G4KleinNishinaCompton::SampleSecondaries(), G4KleinNishinaModel::SampleSecondaries(), G4PairProductionRelModel::SampleSecondaries(), G4eBremsstrahlungRelModel::SampleSecondaries(), G4eBremParametrizedModel::SampleSecondaries(), G4eeToTwoGammaModel::SampleSecondaries(), G4MuPairProductionModel::SampleSecondaries(), G4MuBremsstrahlungModel::SampleSecondaries(), G4NucleiModel::zoneIntegralGaussian(), and G4NucleiModel::zoneIntegralWoodsSaxon().

181 {
182  G4double x = initial_x;
184 
185  const int32_t n = int32_t(px);
186 
187  x -= px * 6.93145751953125E-1;
188  x -= px * 1.42860682030941723212E-6;
189 
190  const G4double xx = x * x;
191 
192  // px = x * P(x**2).
193  px = G4ExpConsts::PX1exp;
194  px *= xx;
195  px += G4ExpConsts::PX2exp;
196  px *= xx;
197  px += G4ExpConsts::PX3exp;
198  px *= x;
199 
200  // Evaluate Q(x**2).
202  qx *= xx;
203  qx += G4ExpConsts::QX2exp;
204  qx *= xx;
205  qx += G4ExpConsts::QX3exp;
206  qx *= xx;
207  qx += G4ExpConsts::QX4exp;
208 
209  // e**x = 1 + 2x P(x**2)/( Q(x**2) - P(x**2) )
210  x = px / (qx - px);
211  x = 1.0 + 2.0 * x;
212 
213  // Build 2^n in double.
214  x *= G4ExpConsts::uint642dp(( ((uint64_t)n) +1023)<<52);
215 
216  if (initial_x > G4ExpConsts::EXP_LIMIT)
217  x = std::numeric_limits<G4double>::infinity();
218  if (initial_x < -G4ExpConsts::EXP_LIMIT)
219  x = 0.;
220 
221  return x;
222 }
const G4double QX1exp
Definition: G4Exp.hh:78
G4double fpfloor(const G4double x)
Definition: G4Exp.hh:154
const G4double EXP_LIMIT
Definition: G4Exp.hh:73
const G4double LOG2E
Definition: G4Exp.hh:83
const G4double QX2exp
Definition: G4Exp.hh:79
const G4double PX3exp
Definition: G4Exp.hh:77
const G4double PX1exp
Definition: G4Exp.hh:75
const G4double QX4exp
Definition: G4Exp.hh:81
const G4int n
const G4double QX3exp
Definition: G4Exp.hh:80
G4double uint642dp(uint64_t ll)
Definition: G4Exp.hh:121
double G4double
Definition: G4Types.hh:76
const G4double PX2exp
Definition: G4Exp.hh:76
G4float G4Expf ( G4float  initial_x)
inline

Exponential Function single precision.

Definition at line 227 of file G4Exp.hh.

References G4ExpConsts::C1F, G4ExpConsts::C2F, G4ExpConsts::fpfloor(), G4ExpConsts::LOG2EF, G4ExpConsts::MAXLOGF, G4ExpConsts::MINLOGF, n, G4ExpConsts::PX1expf, G4ExpConsts::PX2expf, G4ExpConsts::PX3expf, G4ExpConsts::PX4expf, G4ExpConsts::PX5expf, G4ExpConsts::PX6expf, G4ExpConsts::uint322sp(), test::x, and z.

228 {
229  G4float x = initial_x;
230 
231  G4float z = G4ExpConsts::fpfloor( G4ExpConsts::LOG2EF * x +0.5f ); /* floor() truncates toward -infinity. */
232 
233  x -= z * G4ExpConsts::C1F;
234  x -= z * G4ExpConsts::C2F;
235  const int32_t n = int32_t ( z );
236 
237  const G4float x2 = x * x;
238 
239  z = x*G4ExpConsts::PX1expf;
241  z *= x;
243  z *= x;
245  z *= x;
247  z *= x;
249  z *= x;
251  z *= x2;
252  z += x + 1.0f;
253 
254  /* multiply by power of 2 */
255  z *= G4ExpConsts::uint322sp((n+0x7f)<<23);
256 
257  if (initial_x > G4ExpConsts::MAXLOGF) z=std::numeric_limits<G4float>::infinity();
258  if (initial_x < G4ExpConsts::MINLOGF) z=0.f;
259 
260  return z;
261 }
G4double fpfloor(const G4double x)
Definition: G4Exp.hh:154
G4double z
Definition: TRTMaterials.hh:39
float G4float
Definition: G4Types.hh:77
const G4float PX1expf
Definition: G4Exp.hh:91
const G4float C1F
Definition: G4Exp.hh:88
const G4float PX4expf
Definition: G4Exp.hh:94
const G4float PX2expf
Definition: G4Exp.hh:92
const G4float MAXLOGF
Definition: G4Exp.hh:85
const G4float PX3expf
Definition: G4Exp.hh:93
G4float uint322sp(G4int x)
Definition: G4Exp.hh:131
const G4float C2F
Definition: G4Exp.hh:89
const G4int n
const G4float LOG2EF
Definition: G4Exp.hh:98
const G4float PX6expf
Definition: G4Exp.hh:96
const G4float MINLOGF
Definition: G4Exp.hh:86
const G4float PX5expf
Definition: G4Exp.hh:95
void G4Expfv ( const uint32_t  size,
G4float const *__restrict__  iarray,
G4float *__restrict__  oarray 
)
void G4Expv ( const uint32_t  size,
G4double const *__restrict__  iarray,
G4double *__restrict__  oarray 
)