Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Exp.hh File Reference
#include "G4Types.hh"
#include "G4IEEE754.hh"
#include <cstdint>
#include <limits>

Go to the source code of this file.

Namespaces

namespace  G4ExpConsts

Functions

G4double G4ExpConsts::fpfloor (const G4double x)
G4float G4ExpConsts::fpfloor (const G4float x)
G4double G4Exp (G4double initial_x)
 Exponential Function double precision.
G4float G4Expf (G4float initial_x)
 Exponential Function single precision.

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

◆ G4Exp()

G4double G4Exp ( G4double initial_x)
inline

Exponential Function double precision.

Definition at line 132 of file G4Exp.hh.

133{
134 G4double x = initial_x;
136
137 const int32_t n = int32_t(px);
138
139 x -= px * 6.93145751953125E-1;
140 x -= px * 1.42860682030941723212E-6;
141
142 const G4double xx = x * x;
143
144 // px = x * P(x**2).
146 px *= xx;
148 px *= xx;
150 px *= x;
151
152 // Evaluate Q(x**2).
154 qx *= xx;
156 qx *= xx;
158 qx *= xx;
160
161 // e**x = 1 + 2x P(x**2)/( Q(x**2) - P(x**2) )
162 x = px / (qx - px);
163 x = 1.0 + 2.0 * x;
164
165 // Build 2^n in double.
166 x *= G4IEEE754::uint642dp((((uint64_t) n) + 1023) << 52);
167
168 if(initial_x > G4ExpConsts::EXP_LIMIT)
169 x = std::numeric_limits<G4double>::infinity();
170 if(initial_x < -G4ExpConsts::EXP_LIMIT)
171 x = 0.;
172
173 return x;
174}
double G4double
Definition G4Types.hh:83
const G4double QX3exp
Definition G4Exp.hh:80
const G4double QX4exp
Definition G4Exp.hh:81
const G4double PX3exp
Definition G4Exp.hh:77
const G4double EXP_LIMIT
Definition G4Exp.hh:73
G4double fpfloor(const G4double x)
Definition G4Exp.hh:106
const G4double PX1exp
Definition G4Exp.hh:75
const G4double QX1exp
Definition G4Exp.hh:78
const G4double PX2exp
Definition G4Exp.hh:76
const G4double LOG2E
Definition G4Exp.hh:83
const G4double QX2exp
Definition G4Exp.hh:79
G4double uint642dp(uint64_t ll)
Definition G4IEEE754.hh:66

Referenced by G4DynamicParticleMSC::AlongStepDoIt(), G4NuclNuclDiffuseElastic::AmplitudeGG(), G4NuclNuclDiffuseElastic::AmplitudeGla(), G4Nucleus::AnnihilationEvaporationEffects(), G4WilsonAbrasionModel::ApplyYourself(), G4DNAMolecularReactionData::ArrehniusParam(), G4EmCorrections::BarkasCorrection(), G4WilsonAblationModel::BreakItUp(), G4LightIonQMDMeanField::Cal2BodyQuantities(), G4LightIonQMDMeanField::Cal2BodyQuantities(), G4QMDMeanField::Cal2BodyQuantities(), G4QMDMeanField::Cal2BodyQuantities(), G4StatMFMacroBiNucleon::CalcMeanMultiplicity(), G4StatMFMacroMultiNucleon::CalcMeanMultiplicity(), G4StatMFMacroNucleon::CalcMeanMultiplicity(), G4StatMFMacroTetraNucleon::CalcMeanMultiplicity(), G4StatMFMacroTriNucleon::CalcMeanMultiplicity(), G4StatMFMicroPartition::CalcPartitionProbability(), G4LinLogInterpolation::Calculate(), G4LinLogInterpolation::Calculate(), G4ecpssrBaseKxsModel::CalculateCrossSection(), G4ecpssrBaseLixsModel::CalculateL1CrossSection(), G4OrlicLiXsModel::CalculateL1CrossSection(), G4ecpssrBaseLixsModel::CalculateL2CrossSection(), G4OrlicLiXsModel::CalculateL2CrossSection(), G4ecpssrBaseLixsModel::CalculateL3CrossSection(), G4OrlicLiXsModel::CalculateL3CrossSection(), G4PreCompoundTransitions::CalculateProbability(), G4PreCompoundTransitionsInt::CalculateProbability(), G4Reggeons::CalculateXs(), G4LightIonQMDCollision::CalFinalStateOfTheBinaryCollisionJQMD(), G4QMDCollision::CalFinalStateOfTheBinaryCollisionJQMD(), G4Reggeons::Chi_pomeron(), G4Reggeons::Chi_reggeon(), G4NucleiModel::choosePointAlongTraj(), G4Nucleus::Cinema(), G4Clebsch::ClebschGordanCoeff(), G4KalbachCrossSection::ComputeCrossSection(), G4GammaConversionToMuons::ComputeCrossSectionPerAtom(), G4KleinNishinaCompton::ComputeCrossSectionPerAtom(), G4KleinNishinaModel::ComputeCrossSectionPerAtom(), G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom(), G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom(), G4PenelopeRayleighModel::ComputeCrossSectionPerAtom(), G4PenelopeRayleighModelMI::ComputeCrossSectionPerAtom(), G4AnnihiToMuPair::ComputeCrossSectionPerElectron(), G4MuBetheBlochModel::ComputeCrossSectionPerElectron(), G4eDPWAElasticDCS::ComputeCSPerAtom(), G4KokoulinMuonNuclearXS::ComputeDDMicroscopicCrossSection(), G4MuBetheBlochModel::ComputeDEDXPerVolume(), G4MuonToMuonPairProductionModel::ComputeDMicroscopicCrossSection(), G4MuPairProductionModel::ComputeDMicroscopicCrossSection(), G4RiGeMuPairProductionModel::ComputeDMicroscopicCrossSection(), G4LivermoreBremsstrahlungModel::ComputeDXSectionPerAtom(), G4PhotoNuclearCrossSection::ComputeElementXSection(), G4UrbanAdjointMscModel::ComputeGeomPathLength(), G4UrbanMscModel::ComputeGeomPathLength(), G4WentzelVIModel::ComputeGeomPathLength(), G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(), G4MuPairProductionModel::ComputeMicroscopicCrossSection(), G4RiGeMuPairProductionModel::ComputeMicroscopicCrossSection(), G4EvaporationProbability::ComputeProbability(), G4UrbanAdjointMscModel::ComputeTheta0(), G4UrbanMscModel::ComputeTheta0(), G4UrbanAdjointMscModel::ComputeTrueStepLength(), G4UrbanMscModel::ComputeTrueStepLength(), G4RToEConvForElectron::ComputeValue(), G4RToEConvForGamma::ComputeValue(), G4RToEConvForPositron::ComputeValue(), G4MuPairProductionModel::ComputMuPairLoss(), G4RiGeMuPairProductionModel::ComputMuPairLoss(), G4DiffractiveExcitation::CreateStrings(), G4LowEXsection::CrossSection(), G4XpimNTotal::CrossSection(), G4XpipNTotal::CrossSection(), G4DNABornIonisationModel1::CrossSectionPerVolume(), G4DNABornIonisationModel2::CrossSectionPerVolume(), G4DNABornIonisationModel::CrossSectionPerVolume(), G4MuonToMuonPairProductionModel::DataCorrupted(), G4MuPairProductionModel::DataCorrupted(), G4RiGeMuPairProductionModel::DataCorrupted(), G4EquilibriumEvaporator::deExcite(), G4FissionParameters::DefineParameters(), G4EmCorrections::DensityCorrection(), G4AtimaFluctuations::Dispersion(), G4PenelopeRayleighModel::DumpFormFactorTable(), G4PenelopeRayleighModelMI::DumpFormFactorTable(), G4ionEffectiveCharge::EffectiveCharge(), G4FissionProbability::EmissionProbability(), G4PhysicsFreeVector::EnableLogBinSearch(), epsilon(), G4LegendrePolynomial::EvalAssocLegendrePoly(), G4Nucleus::EvaporationEffects(), G4Pow::expA(), G4ecpssrBaseKxsModel::ExpIntFunction(), G4ecpssrBaseLixsModel::ExpIntFunction(), G4QuasiElRatios::FetchElTot(), G4HadXSHelper::FillPeaksStructure(), G4NucleiModel::fillZoneRadii(), G4EmUtility::FindCrossSectionMax(), G4HadXSHelper::FindCrossSectionMax(), G4DNASmoluchowskiReactionModel::FindReaction(), G4JTPolynomialSolver::FindRoots(), G4AtimaEnergyLossModel::G4AtimaEnergyLossModel(), G4AtimaFluctuations::G4AtimaFluctuations(), G4InuclSpecialFunctions::G4cbrt(), G4ElasticHadrNucleusHE::G4ElasticHadrNucleusHE(), G4LightIonQMDGroundStateNucleus::G4LightIonQMDGroundStateNucleus(), G4MuBremsstrahlungModel::G4MuBremsstrahlungModel(), G4MuPairProductionModel::G4MuPairProductionModel(), G4ParticleHPFissionSpectrum::G4ParticleHPFissionSpectrum(), G4ParticleHPMadlandNixSpectrum::G4ParticleHPMadlandNixSpectrum(), G4ParticleHPSimpleEvapSpectrum::G4ParticleHPSimpleEvapSpectrum(), G4ParticleHPWattSpectrum::G4ParticleHPWattSpectrum(), G4PhysicsLogVector::G4PhysicsLogVector(), G4Poisson(), G4QMDGroundStateNucleus::G4QMDGroundStateNucleus(), G4RiGeMuPairProductionModel::G4RiGeMuPairProductionModel(), G4XNNElasticLowE::G4XNNElasticLowE(), G4XnpElasticLowE::G4XnpElasticLowE(), G4XnpTotalLowE::G4XnpTotalLowE(), G4FTFParameters::GammaElastic(), G4IntraNucleiCascader::generateCascade(), G4eeToHadronsModel::GenerateCMPhoton(), G4FissionStore::generateConfiguration(), G4CascadeFinalStateAlgorithm::GenerateCosTheta(), G4NucleiModel::generateInteractionLength(), G4AtomicFormFactor::Get(), G4ParticleHPInterpolator::GetBinIntegral(), G4DNASmoluchowskiDiffusion::GetCumulativeProbability(), G4IonisParamMat::GetDensityCorrection(), G4DNASmoluchowskiDiffusion::GetDensityProbability(), G4NuclearFermiDensity::GetDeriv(), G4DiffuseElastic::GetDiffElasticProb(), G4NuclNuclDiffuseElastic::GetDiffElasticProb(), G4DiffuseElastic::GetDiffElasticSumProb(), G4NuclNuclDiffuseElastic::GetDiffElasticSumProb(), G4DiffuseElastic::GetDiffElasticSumProbA(), G4DiffuseElasticV2::GetDiffElasticSumProbA(), G4NuclNuclDiffuseElastic::GetDiffElasticSumProbA(), G4DNASmoluchowskiDiffusion::GetDifferential(), G4PhotonEvaporation::GetEmissionProbability(), G4ElectroNuclearCrossSection::GetEquivalentPhotonEnergy(), G4ElectroNuclearCrossSection::GetEquivalentPhotonQ2(), G4NuclNuclDiffuseElastic::GetErfComp(), G4ChipsAntiBaryonElasticXS::GetExchangeT(), G4ChipsHyperonElasticXS::GetExchangeT(), G4ChipsPionMinusElasticXS::GetExchangeT(), G4ChipsPionPlusElasticXS::GetExchangeT(), G4NuclNuclDiffuseElastic::GetExpCos(), G4hhElastic::GetExpRatioF123(), G4NuclNuclDiffuseElastic::GetExpSin(), G4PenelopeCrossSection::GetHardCrossSection(), G4MicroElecCapture::GetMeanFreePath(), G4PenelopeCrossSection::GetNormalizedShellCrossSection(), G4HyperNucleiProperties::GetNuclearMass(), G4Reggeons::GetProbabilities(), G4FTFParameters::GetProcProb(), G4NuclearFermiDensity::GetRadius(), G4NuclearFermiDensity::GetRelativeDensity(), G4NuclearShellModelDensity::GetRelativeDensity(), G4PenelopeCrossSection::GetShellCrossSection(), G4PenelopePhotoElectricModel::GetShellCrossSection(), G4PenelopeCrossSection::GetSoftStoppingPower(), G4PenelopeCrossSection::GetTotalCrossSection(), G4ElectroNuclearCrossSection::GetVirtualFactor(), G4ParticleHPInterpolator::GetWeightedBinIntegral(), G4EMDissociationCrossSection::GetWilsonProbabilityForProtonDissociation(), G4HadronNucleonXsc::HadronNucleonXscEL(), G4HadronNucleonXsc::HadronNucleonXscNS(), G4HadronNucleonXsc::HadronNucleonXscPDG(), G4HadronNucleonXsc::HadronNucleonXscVU(), G4VhElectronicStoppingPower::HeEffChargeSquare(), G4Bessel::I0(), G4Bessel::I1(), G4FTFParameters::InitForInteraction(), G4WentzelOKandVIxSection::InitialiseA(), G4BetheHeitlerModel::InitialiseElementData(), G4NucleiModel::initializeCascad(), G4eDPWAElasticDCS::InitSCPCorrection(), G4GoudsmitSaundersonTable::InitSCPCorrection(), G4ParticleHPVector::Integrate(), G4LEPTSDiffXS::InterpolateCDXS(), G4Bessel::K0(), G4Bessel::K1(), G4ParticleHPKallbachMannSyst::Kallbach(), G4HadronNucleonXsc::KaonNucleonXscVG(), G4ExtendedPhysicsVector::LogLogValue(), G4MuPairProductionModel::MakeSamplingTables(), G4RiGeMuPairProductionModel::MakeSamplingTables(), G4Reggeons::ncPomerons(), G4NuclearRadii::NeutronInelasticShape(), G4DiffuseElastic::NeutronTuniform(), G4DiffuseElasticV2::NeutronTuniform(), G4PenelopeCrossSection::NormalizeShellCrossSections(), G4Bessel::pI0(), G4Bessel::pI1(), G4GammaConversionToMuons::PostStepDoIt(), G4PenelopeBremsstrahlungAngular::PrepareTables(), G4IonDEDXHandler::PrintDEDXTable(), G4IonParametrisedLossModel::PrintDEDXTable(), G4DNARuddIonisationDynamicModel::ProbabilityDensityFunction(), G4GEMChannelVI::ProbabilityDensityFunction(), G4NuclNuclDiffuseElastic::ProfileFar(), G4NuclNuclDiffuseElastic::ProfileNear(), G4NuclearRadii::ProtonInelasticShape(), G4NuclearRadii::RadiusHNGG(), G4NuclearRadii::RadiusNNGG(), G4XrayReflection::Reflectivity(), G4RiGeAngularGenerator::Sample5DPairDirections(), G4Generator2BN::SampleDirection(), G4PenelopeBremsstrahlungAngular::SampleDirection(), G4RayleighAngularGenerator::SampleDirection(), G4eIonisationSpectrum::SampleEnergy(), G4SBBremTable::SampleEnergyTransfer(), G4PenelopeBremsstrahlungFS::SampleGammaEnergy(), G4PolarizationTransition::SampleGammaTransition(), G4AntiNuclElastic::SampleInvariantT(), G4HadronElastic::SampleInvariantT(), G4VLongitudinalStringDecay::SampleQuarkPt(), G4ExtendedPhysicsVector::SampleReactionChannelLogLog(), G4WentzelVIModel::SampleScattering(), G4BetheHeitler5DModel::SampleSecondaries(), G4BoldyshevTripletModel::SampleSecondaries(), G4eBremParametrizedModel::SampleSecondaries(), G4eBremsstrahlungRelModel::SampleSecondaries(), G4KleinNishinaCompton::SampleSecondaries(), G4KleinNishinaModel::SampleSecondaries(), G4LivermoreBremsstrahlungModel::SampleSecondaries(), G4LivermoreComptonModel::SampleSecondaries(), G4LivermoreNuclearGammaConversionModel::SampleSecondaries(), G4LivermorePolarizedComptonModel::SampleSecondaries(), G4LivermorePolarizedGammaConversionModel::SampleSecondaries(), G4LowEPComptonModel::SampleSecondaries(), G4LowEPPolarizedComptonModel::SampleSecondaries(), G4MuBremsstrahlungModel::SampleSecondaries(), G4MuonToMuonPairProductionModel::SampleSecondaries(), G4MuPairProductionModel::SampleSecondaries(), G4PenelopeComptonModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), G4RiGeMuPairProductionModel::SampleSecondaries(), G4WentzelOKandVIxSection::SampleSingleScattering(), G4ChargeExchange::SampleT(), G4ChargeExchangeXS::SampleTforPion(), G4GoudsmitSaundersonTable::Sampling(), G4IonCoulombCrossSection::SetupTarget(), G4hICRU49He::StoppingPower(), G4ePairProduction::StreamProcessInfo(), G4EvaporationProbability::TotalProbability(), G4Clebsch::TriangleCoeff(), G4MuonToMuonPairProductionModel::U_func(), G4Clebsch::Wigner6J(), G4Clebsch::WignerLittleD(), G4NucleiModel::zoneIntegralGaussian(), and G4NucleiModel::zoneIntegralWoodsSaxon().

◆ G4Expf()

G4float G4Expf ( G4float initial_x)
inline

Exponential Function single precision.

Definition at line 179 of file G4Exp.hh.

180{
181 G4float x = initial_x;
182
183 G4float z =
185 0.5f); /* std::floor() truncates toward -infinity. */
186
187 x -= z * G4ExpConsts::C1F;
188 x -= z * G4ExpConsts::C2F;
189 const int32_t n = int32_t(z);
190
191 const G4float x2 = x * x;
192
193 z = x * G4ExpConsts::PX1expf;
195 z *= x;
197 z *= x;
199 z *= x;
201 z *= x;
203 z *= x2;
204 z += x + 1.0f;
205
206 /* multiply by power of 2 */
207 z *= G4IEEE754::uint322sp((n + 0x7f) << 23);
208
209 if(initial_x > G4ExpConsts::MAXLOGF)
210 z = std::numeric_limits<G4float>::infinity();
211 if(initial_x < G4ExpConsts::MINLOGF)
212 z = 0.f;
213
214 return z;
215}
float G4float
Definition G4Types.hh:84
const G4float C1F
Definition G4Exp.hh:88
const G4float PX1expf
Definition G4Exp.hh:91
const G4float LOG2EF
Definition G4Exp.hh:98
const G4float PX6expf
Definition G4Exp.hh:96
const G4float PX4expf
Definition G4Exp.hh:94
const G4float MINLOGF
Definition G4Exp.hh:86
const G4float PX3expf
Definition G4Exp.hh:93
const G4float MAXLOGF
Definition G4Exp.hh:85
const G4float PX5expf
Definition G4Exp.hh:95
const G4float PX2expf
Definition G4Exp.hh:92
const G4float C2F
Definition G4Exp.hh:89
G4float uint322sp(G4int x)
Definition G4IEEE754.hh:76