Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4Exp.hh File Reference
#include <limits>
#include <stdint.h>
#include "G4Types.hh"
Include dependency graph for G4Exp.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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 183 of file G4Exp.hh.

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

Here is the call graph for this function:

G4float G4Expf ( G4float  initial_x)
inline

Exponential Function single precision.

Definition at line 230 of file G4Exp.hh.

231 {
232  G4float x = initial_x;
233 
234  G4float z = G4ExpConsts::fpfloor( G4ExpConsts::LOG2EF * x +0.5f ); /* std::floor() truncates toward -infinity. */
235 
236  x -= z * G4ExpConsts::C1F;
237  x -= z * G4ExpConsts::C2F;
238  const int32_t n = int32_t ( z );
239 
240  const G4float x2 = x * x;
241 
242  z = x*G4ExpConsts::PX1expf;
244  z *= x;
246  z *= x;
248  z *= x;
250  z *= x;
252  z *= x2;
253  z += x + 1.0f;
254 
255  /* multiply by power of 2 */
256  z *= G4ExpConsts::uint322sp((n+0x7f)<<23);
257 
258  if (initial_x > G4ExpConsts::MAXLOGF) z=std::numeric_limits<G4float>::infinity();
259  if (initial_x < G4ExpConsts::MINLOGF) z=0.f;
260 
261  return z;
262 }
G4double fpfloor(const G4double x)
Definition: G4Exp.hh:157
float G4float
Definition: G4Types.hh:77
const G4float PX1expf
Definition: G4Exp.hh:94
const G4float C1F
Definition: G4Exp.hh:91
const G4float PX4expf
Definition: G4Exp.hh:97
const G4float PX2expf
Definition: G4Exp.hh:95
const G4float MAXLOGF
Definition: G4Exp.hh:88
const G4float PX3expf
Definition: G4Exp.hh:96
G4float uint322sp(G4int x)
Definition: G4Exp.hh:134
const G4float C2F
Definition: G4Exp.hh:92
const G4float LOG2EF
Definition: G4Exp.hh:101
const G4float PX6expf
Definition: G4Exp.hh:99
const G4float MINLOGF
Definition: G4Exp.hh:89
const G4float PX5expf
Definition: G4Exp.hh:98

Here is the call graph for this function:

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 
)