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

Go to the source code of this file.

Classes

union  G4LogConsts::ieee754
 

Namespaces

 G4LogConsts
 

Functions

G4double G4LogConsts::get_log_px (const G4double x)
 
G4double G4LogConsts::get_log_qx (const G4double x)
 
uint64_t G4LogConsts::dp2uint64 (G4double x)
 
G4double G4LogConsts::uint642dp (uint64_t ll)
 
G4float G4LogConsts::uint322sp (G4int x)
 
uint32_t G4LogConsts::sp2uint32 (G4float x)
 
G4double G4LogConsts::getMantExponent (const G4double x, G4double &fe)
 Like frexp but vectorising and the exponent is a double. More...
 
G4float G4LogConsts::getMantExponentf (const G4float x, G4float &fe)
 Like frexp but vectorising and the exponent is a float. More...
 
G4double G4Log (G4double x)
 
G4float G4LogConsts::get_log_poly (const G4float x)
 
G4float G4Logf (G4float x)
 
void logv (const uint32_t size, G4double const *__restrict__ iarray, G4double *__restrict__ oarray)
 
void G4Logv (const uint32_t size, G4double const *__restrict__ iarray, G4double *__restrict__ oarray)
 
void logfv (const uint32_t size, G4float const *__restrict__ iarray, G4float *__restrict__ oarray)
 
void G4Logfv (const uint32_t size, G4float const *__restrict__ iarray, G4float *__restrict__ oarray)
 

Variables

const G4double G4LogConsts::LOG_UPPER_LIMIT = 1e307
 
const G4double G4LogConsts::LOG_LOWER_LIMIT = 0
 
const G4double G4LogConsts::SQRTH = 0.70710678118654752440
 
const G4float G4LogConsts::MAXNUMF = 3.4028234663852885981170418348451692544e38f
 
const G4float G4LogConsts::LOGF_UPPER_LIMIT = MAXNUMF
 
const G4float G4LogConsts::LOGF_LOWER_LIMIT = 0
 
const G4float G4LogConsts::PX1logf = 7.0376836292E-2f
 
const G4float G4LogConsts::PX2logf = -1.1514610310E-1f
 
const G4float G4LogConsts::PX3logf = 1.1676998740E-1f
 
const G4float G4LogConsts::PX4logf = -1.2420140846E-1f
 
const G4float G4LogConsts::PX5logf = 1.4249322787E-1f
 
const G4float G4LogConsts::PX6logf = -1.6668057665E-1f
 
const G4float G4LogConsts::PX7logf = 2.0000714765E-1f
 
const G4float G4LogConsts::PX8logf = -2.4999993993E-1f
 
const G4float G4LogConsts::PX9logf = 3.3333331174E-1f
 
const G4float G4LogConsts::SQRTHF = 0.707106781186547524f
 

Function Documentation

G4double G4Log ( G4double  x)
inline

Definition at line 230 of file G4Log.hh.

231 {
232  const G4double original_x = x;
233 
234  /* separate mantissa from exponent */
235  G4double fe;
237 
238  // blending
239  x > G4LogConsts::SQRTH? fe+=1. : x+=x ;
240  x -= 1.0;
241 
242  /* rational form */
244 
245  //for the final formula
246  const G4double x2 = x*x;
247  px *= x;
248  px *= x2;
249 
250  const G4double qx = G4LogConsts::get_log_qx(x);
251 
252  G4double res = px / qx ;
253 
254  res -= fe * 2.121944400546905827679e-4;
255  res -= 0.5 * x2 ;
256 
257  res = x + res;
258  res += fe * 0.693359375;
259 
260  if (original_x > G4LogConsts::LOG_UPPER_LIMIT)
261  res = std::numeric_limits<G4double>::infinity();
262  if (original_x < G4LogConsts::LOG_LOWER_LIMIT) // THIS IS NAN!
263  res = - std::numeric_limits<G4double>::quiet_NaN();
264 
265  return res;
266 }
G4double get_log_qx(const G4double x)
Definition: G4Log.hh:126
const G4double SQRTH
Definition: G4Log.hh:82
G4double getMantExponent(const G4double x, G4double &fe)
Like frexp but vectorising and the exponent is a double.
Definition: G4Log.hh:189
G4double get_log_px(const G4double x)
Definition: G4Log.hh:103
const G4double LOG_LOWER_LIMIT
Definition: G4Log.hh:80
const G4double LOG_UPPER_LIMIT
Definition: G4Log.hh:79
double G4double
Definition: G4Types.hh:76
G4fissionEvent * fe

Here is the call graph for this function:

G4float G4Logf ( G4float  x)
inline

Definition at line 311 of file G4Log.hh.

312 {
313  const G4float original_x = x;
314 
315  G4float fe;
316  x = G4LogConsts::getMantExponentf( x, fe);
317 
318  x > G4LogConsts::SQRTHF? fe+=1.f : x+=x ;
319  x -= 1.0f;
320 
321  const G4float x2 = x*x;
322 
324  res *= x2*x;
325 
326  res += -2.12194440e-4f * fe;
327  res += -0.5f * x2;
328 
329  res= x + res;
330 
331  res += 0.693359375f * fe;
332 
333  if (original_x > G4LogConsts::LOGF_UPPER_LIMIT)
334  res = std::numeric_limits<G4float>::infinity();
335  if (original_x < G4LogConsts::LOGF_LOWER_LIMIT)
336  res = -std::numeric_limits<G4float>::quiet_NaN();
337 
338  return res;
339 }
G4float getMantExponentf(const G4float x, G4float &fe)
Like frexp but vectorising and the exponent is a float.
Definition: G4Log.hh:213
const G4float LOGF_UPPER_LIMIT
Definition: G4Log.hh:272
float G4float
Definition: G4Types.hh:77
const G4float LOGF_LOWER_LIMIT
Definition: G4Log.hh:273
const G4float SQRTHF
Definition: G4Log.hh:306
G4float get_log_poly(const G4float x)
Definition: G4Log.hh:285
G4fissionEvent * fe

Here is the call graph for this function:

void G4Logfv ( const uint32_t  size,
G4float const *__restrict__  iarray,
G4float *__restrict__  oarray 
)
void G4Logv ( const uint32_t  size,
G4double const *__restrict__  iarray,
G4double *__restrict__  oarray 
)
void logfv ( const uint32_t  size,
G4float const *__restrict__  iarray,
G4float *__restrict__  oarray 
)
void logv ( const uint32_t  size,
G4double const *__restrict__  iarray,
G4double *__restrict__  oarray 
)