Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Functions | Variables
G4LogConsts Namespace Reference

Data Structures

union  ieee754
 

Functions

G4double get_log_px (const G4double x)
 
G4double get_log_qx (const G4double x)
 
uint64_t dp2uint64 (G4double x)
 
G4double uint642dp (uint64_t ll)
 
G4float uint322sp (G4int x)
 
uint32_t sp2uint32 (G4float x)
 
G4double getMantExponent (const G4double x, G4double &fe)
 Like frexp but vectorising and the exponent is a double. More...
 
G4float getMantExponentf (const G4float x, G4float &fe)
 Like frexp but vectorising and the exponent is a float. More...
 
G4float get_log_poly (const G4float x)
 

Variables

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

Function Documentation

uint64_t G4LogConsts::dp2uint64 ( G4double  x)
inline

Definition at line 147 of file G4Log.hh.

References G4LogConsts::ieee754::d, G4LogConsts::ieee754::ll, and test::x.

Referenced by getMantExponent().

148  {
149  ieee754 tmp;
150  tmp.d=x;
151  return tmp.ll;
152  }
G4float G4LogConsts::get_log_poly ( const G4float  x)
inline

Definition at line 282 of file G4Log.hh.

References PX1logf, PX2logf, PX3logf, PX4logf, PX5logf, PX6logf, PX7logf, PX8logf, PX9logf, and test::x.

Referenced by G4Logf().

283  {
284  G4float y = x*PX1logf;
285  y += PX2logf;
286  y *= x;
287  y += PX3logf;
288  y *= x;
289  y += PX4logf;
290  y *= x;
291  y += PX5logf;
292  y *= x;
293  y += PX6logf;
294  y *= x;
295  y += PX7logf;
296  y *= x;
297  y += PX8logf;
298  y *= x;
299  y += PX9logf;
300  return y;
301  }
const G4float PX1logf
Definition: G4Log.hh:272
const G4float PX2logf
Definition: G4Log.hh:273
float G4float
Definition: G4Types.hh:77
const G4float PX4logf
Definition: G4Log.hh:275
const G4float PX6logf
Definition: G4Log.hh:277
const G4float PX9logf
Definition: G4Log.hh:280
const G4float PX7logf
Definition: G4Log.hh:278
const G4float PX5logf
Definition: G4Log.hh:276
const G4float PX8logf
Definition: G4Log.hh:279
const G4float PX3logf
Definition: G4Log.hh:274
G4double G4LogConsts::get_log_px ( const G4double  x)
inline

Definition at line 100 of file G4Log.hh.

References test::x.

Referenced by G4Log().

101  {
102  const G4double PX1log = 1.01875663804580931796E-4;
103  const G4double PX2log = 4.97494994976747001425E-1;
104  const G4double PX3log = 4.70579119878881725854E0;
105  const G4double PX4log = 1.44989225341610930846E1;
106  const G4double PX5log = 1.79368678507819816313E1;
107  const G4double PX6log = 7.70838733755885391666E0;
108 
109  G4double px = PX1log;
110  px *= x;
111  px += PX2log;
112  px *= x;
113  px += PX3log;
114  px *= x;
115  px += PX4log;
116  px *= x;
117  px += PX5log;
118  px *= x;
119  px += PX6log;
120  return px;
121  }
double G4double
Definition: G4Types.hh:76
G4double G4LogConsts::get_log_qx ( const G4double  x)
inline

Definition at line 123 of file G4Log.hh.

References test::x.

Referenced by G4Log().

124  {
125  const G4double QX1log = 1.12873587189167450590E1;
126  const G4double QX2log = 4.52279145837532221105E1;
127  const G4double QX3log = 8.29875266912776603211E1;
128  const G4double QX4log = 7.11544750618563894466E1;
129  const G4double QX5log = 2.31251620126765340583E1;
130 
131  G4double qx = x;
132  qx += QX1log;
133  qx *=x;
134  qx += QX2log;
135  qx *=x;
136  qx += QX3log;
137  qx *=x;
138  qx += QX4log;
139  qx *=x;
140  qx += QX5log;
141  return qx;
142  }
double G4double
Definition: G4Types.hh:76
G4double G4LogConsts::getMantExponent ( const G4double  x,
G4double fe 
)
inline

Like frexp but vectorising and the exponent is a double.

Definition at line 186 of file G4Log.hh.

References dp2uint64(), n, and uint642dp().

Referenced by G4Log().

187  {
188  uint64_t n = dp2uint64(x);
189 
190  // Shift to the right up to the beginning of the exponent.
191  // Then with a mask, cut off the sign bit
192  uint64_t le = (n >> 52);
193 
194  // chop the head of the number: an int contains more than 11 bits (32)
195  int32_t e = le; // This is important since sums on uint64_t do not vectorise
196  fe = e-1023 ;
197 
198  // This puts to 11 zeroes the exponent
199  n &=0x800FFFFFFFFFFFFFULL;
200  // build a mask which is 0.5, i.e. an exponent equal to 1022
201  // which means *2, see the above +1.
202  const uint64_t p05 = 0x3FE0000000000000ULL; //dp2uint64(0.5);
203  n |= p05;
204 
205  return uint642dp(n);
206  }
const G4int n
G4double uint642dp(uint64_t ll)
Definition: G4Log.hh:157
uint64_t dp2uint64(G4double x)
Definition: G4Log.hh:147
G4fissionEvent * fe
G4float G4LogConsts::getMantExponentf ( const G4float  x,
G4float fe 
)
inline

Like frexp but vectorising and the exponent is a float.

Definition at line 210 of file G4Log.hh.

References n, sp2uint32(), and uint322sp().

Referenced by G4Logf().

211  {
212  uint32_t n = sp2uint32(x);
213  int32_t e = (n >> 23)-127;
214  fe = e;
215 
216  // fractional part
217  const uint32_t p05f = 0x3f000000; // //sp2uint32(0.5);
218  n &= 0x807fffff;// ~0x7f800000;
219  n |= p05f;
220 
221  return uint322sp(n);
222  }
uint32_t sp2uint32(G4float x)
Definition: G4Log.hh:177
const G4int n
G4float uint322sp(G4int x)
Definition: G4Log.hh:167
G4fissionEvent * fe
uint32_t G4LogConsts::sp2uint32 ( G4float  x)
inline

Definition at line 177 of file G4Log.hh.

References G4LogConsts::ieee754::f, G4LogConsts::ieee754::i, and test::x.

Referenced by getMantExponentf().

178  {
179  ieee754 tmp;
180  tmp.f[0]=x;
181  return tmp.i[0];
182  }
G4float G4LogConsts::uint322sp ( G4int  x)
inline

Definition at line 167 of file G4Log.hh.

References G4LogConsts::ieee754::f, G4LogConsts::ieee754::i, and test::x.

Referenced by getMantExponentf().

168  {
169  ieee754 tmp;
170  tmp.i[0]=x;
171  return tmp.f[0];
172  }
G4double G4LogConsts::uint642dp ( uint64_t  ll)
inline

Definition at line 157 of file G4Log.hh.

References G4LogConsts::ieee754::d, and G4LogConsts::ieee754::ll.

Referenced by getMantExponent().

158  {
159  ieee754 tmp;
160  tmp.ll=ll;
161  return tmp.d;
162  }

Variable Documentation

const G4double G4LogConsts::LOG_LOWER_LIMIT = 0

Definition at line 77 of file G4Log.hh.

Referenced by G4Log().

const G4double G4LogConsts::LOG_UPPER_LIMIT = 1e307

Definition at line 76 of file G4Log.hh.

Referenced by G4Log().

const G4float G4LogConsts::LOGF_LOWER_LIMIT = 0

Definition at line 270 of file G4Log.hh.

Referenced by G4Logf().

const G4float G4LogConsts::LOGF_UPPER_LIMIT = MAXNUMF

Definition at line 269 of file G4Log.hh.

Referenced by G4Logf().

const G4float G4LogConsts::MAXNUMF = 3.4028234663852885981170418348451692544e38f

Definition at line 80 of file G4Log.hh.

const G4float G4LogConsts::PX1logf = 7.0376836292E-2f

Definition at line 272 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX2logf = -1.1514610310E-1f

Definition at line 273 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX3logf = 1.1676998740E-1f

Definition at line 274 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX4logf = -1.2420140846E-1f

Definition at line 275 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX5logf = 1.4249322787E-1f

Definition at line 276 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX6logf = -1.6668057665E-1f

Definition at line 277 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX7logf = 2.0000714765E-1f

Definition at line 278 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX8logf = -2.4999993993E-1f

Definition at line 279 of file G4Log.hh.

Referenced by get_log_poly().

const G4float G4LogConsts::PX9logf = 3.3333331174E-1f

Definition at line 280 of file G4Log.hh.

Referenced by get_log_poly().

const G4double G4LogConsts::SQRTH = 0.70710678118654752440

Definition at line 79 of file G4Log.hh.

Referenced by G4Log().

const G4float G4LogConsts::SQRTHF = 0.707106781186547524f

Definition at line 303 of file G4Log.hh.

Referenced by G4Logf().