Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4LogConsts Namespace Reference

Classes

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.
 
G4float getMantExponentf (const G4float x, G4float &fe)
 Like frexp but vectorising and the exponent is a float.
 
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

◆ dp2uint64()

uint64_t G4LogConsts::dp2uint64 ( G4double x)
inline

Definition at line 146 of file G4Log.hh.

147 {
148 ieee754 tmp;
149 tmp.d = x;
150 return tmp.ll;
151 }

Referenced by getMantExponent().

◆ get_log_poly()

G4float G4LogConsts::get_log_poly ( const G4float x)
inline

Definition at line 282 of file G4Log.hh.

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 }
float G4float
Definition G4Types.hh:84
const G4float PX1logf
Definition G4Log.hh:272
const G4float PX8logf
Definition G4Log.hh:279
const G4float PX6logf
Definition G4Log.hh:277
const G4float PX3logf
Definition G4Log.hh:274
const G4float PX9logf
Definition G4Log.hh:280
const G4float PX2logf
Definition G4Log.hh:273
const G4float PX5logf
Definition G4Log.hh:276
const G4float PX7logf
Definition G4Log.hh:278
const G4float PX4logf
Definition G4Log.hh:275

Referenced by G4Logf().

◆ get_log_px()

G4double G4LogConsts::get_log_px ( const G4double x)
inline

Definition at line 99 of file G4Log.hh.

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

Referenced by G4Log().

◆ get_log_qx()

G4double G4LogConsts::get_log_qx ( const G4double x)
inline

Definition at line 122 of file G4Log.hh.

123 {
124 const G4double QX1log = 1.12873587189167450590E1;
125 const G4double QX2log = 4.52279145837532221105E1;
126 const G4double QX3log = 8.29875266912776603211E1;
127 const G4double QX4log = 7.11544750618563894466E1;
128 const G4double QX5log = 2.31251620126765340583E1;
129
130 G4double qx = x;
131 qx += QX1log;
132 qx *= x;
133 qx += QX2log;
134 qx *= x;
135 qx += QX3log;
136 qx *= x;
137 qx += QX4log;
138 qx *= x;
139 qx += QX5log;
140 return qx;
141 }

Referenced by G4Log().

◆ getMantExponent()

G4double G4LogConsts::getMantExponent ( const G4double x,
G4double & fe )
inline

Like frexp but vectorising and the exponent is a double.

Definition at line 185 of file G4Log.hh.

186 {
187 uint64_t n = dp2uint64(x);
188
189 // Shift to the right up to the beginning of the exponent.
190 // Then with a mask, cut off the sign bit
191 uint64_t le = (n >> 52);
192
193 // chop the head of the number: an int contains more than 11 bits (32)
194 int32_t e =
195 (int32_t)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 }
G4fissionEvent * fe
uint64_t dp2uint64(G4double x)
Definition G4Log.hh:146
G4double uint642dp(uint64_t ll)
Definition G4Log.hh:156

Referenced by G4Log().

◆ getMantExponentf()

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.

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 }
G4float uint322sp(G4int x)
Definition G4Log.hh:166
uint32_t sp2uint32(G4float x)
Definition G4Log.hh:176

Referenced by G4Logf().

◆ sp2uint32()

uint32_t G4LogConsts::sp2uint32 ( G4float x)
inline

Definition at line 176 of file G4Log.hh.

177 {
178 ieee754 tmp;
179 tmp.f[0] = x;
180 return tmp.i[0];
181 }
uint32_t i[2]
Definition G4Log.hh:94
G4float f[2]
Definition G4Log.hh:93

Referenced by getMantExponentf().

◆ uint322sp()

G4float G4LogConsts::uint322sp ( G4int x)
inline

Definition at line 166 of file G4Log.hh.

167 {
168 ieee754 tmp;
169 tmp.i[0] = x;
170 return tmp.f[0];
171 }

Referenced by getMantExponentf().

◆ uint642dp()

G4double G4LogConsts::uint642dp ( uint64_t ll)
inline

Definition at line 156 of file G4Log.hh.

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

Referenced by getMantExponent().

Variable Documentation

◆ LOG_LOWER_LIMIT

const G4double G4LogConsts::LOG_LOWER_LIMIT = 0

Definition at line 76 of file G4Log.hh.

Referenced by G4Log().

◆ LOG_UPPER_LIMIT

const G4double G4LogConsts::LOG_UPPER_LIMIT = 1e307

Definition at line 75 of file G4Log.hh.

Referenced by G4Log().

◆ LOGF_LOWER_LIMIT

const G4float G4LogConsts::LOGF_LOWER_LIMIT = 0

Definition at line 270 of file G4Log.hh.

Referenced by G4Logf().

◆ LOGF_UPPER_LIMIT

const G4float G4LogConsts::LOGF_UPPER_LIMIT = MAXNUMF

Definition at line 269 of file G4Log.hh.

Referenced by G4Logf().

◆ MAXNUMF

const G4float G4LogConsts::MAXNUMF = 3.4028234663852885981170418348451692544e38f

Definition at line 79 of file G4Log.hh.

◆ PX1logf

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

Definition at line 272 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX2logf

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

Definition at line 273 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX3logf

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

Definition at line 274 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX4logf

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

Definition at line 275 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX5logf

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

Definition at line 276 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX6logf

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

Definition at line 277 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX7logf

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

Definition at line 278 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX8logf

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

Definition at line 279 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX9logf

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

Definition at line 280 of file G4Log.hh.

Referenced by get_log_poly().

◆ SQRTH

const G4double G4LogConsts::SQRTH = 0.70710678118654752440

Definition at line 78 of file G4Log.hh.

Referenced by G4Log().

◆ SQRTHF

const G4float G4LogConsts::SQRTHF = 0.707106781186547524f

Definition at line 303 of file G4Log.hh.

Referenced by G4Logf().