Geant4-11
Data Structures | Functions | Variables
G4LogConsts Namespace Reference

Data Structures

union  ieee754
 

Functions

uint64_t dp2uint64 (G4double x)
 
G4float get_log_poly (const G4float x)
 
G4double get_log_px (const G4double x)
 
G4double get_log_qx (const G4double 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...
 
uint32_t sp2uint32 (G4float x)
 
G4float uint322sp (G4int x)
 
G4double uint642dp (uint64_t ll)
 

Variables

const G4double LOG_LOWER_LIMIT = 0
 
const G4double LOG_UPPER_LIMIT = 1e307
 
const G4float LOGF_LOWER_LIMIT = 0
 
const G4float LOGF_UPPER_LIMIT = MAXNUMF
 
const G4float MAXNUMF = 3.4028234663852885981170418348451692544e38f
 
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 G4double SQRTH = 0.70710678118654752440
 
const G4float SQRTHF = 0.707106781186547524f
 

Function Documentation

◆ dp2uint64()

uint64_t G4LogConsts::dp2uint64 ( G4double  x)
inline

Definition at line 145 of file G4Log.hh.

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

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

Referenced by getMantExponent().

◆ get_log_poly()

G4float G4LogConsts::get_log_poly ( const G4float  x)
inline

Definition at line 281 of file G4Log.hh.

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

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

Referenced by G4Logf().

◆ get_log_px()

G4double G4LogConsts::get_log_px ( const G4double  x)
inline

Definition at line 98 of file G4Log.hh.

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

Referenced by G4Log().

◆ get_log_qx()

G4double G4LogConsts::get_log_qx ( const G4double  x)
inline

Definition at line 121 of file G4Log.hh.

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

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 184 of file G4Log.hh.

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

References dp2uint64(), fe, CLHEP::detail::n, and uint642dp().

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 209 of file G4Log.hh.

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

References fe, CLHEP::detail::n, sp2uint32(), and uint322sp().

Referenced by G4Logf().

◆ sp2uint32()

uint32_t G4LogConsts::sp2uint32 ( G4float  x)
inline

Definition at line 175 of file G4Log.hh.

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

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

Referenced by getMantExponentf().

◆ uint322sp()

G4float G4LogConsts::uint322sp ( G4int  x)
inline

Definition at line 165 of file G4Log.hh.

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

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

Referenced by getMantExponentf().

◆ uint642dp()

G4double G4LogConsts::uint642dp ( uint64_t  ll)
inline

Definition at line 155 of file G4Log.hh.

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

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

Referenced by getMantExponent().

Variable Documentation

◆ LOG_LOWER_LIMIT

const G4double G4LogConsts::LOG_LOWER_LIMIT = 0

Definition at line 75 of file G4Log.hh.

Referenced by G4Log().

◆ LOG_UPPER_LIMIT

const G4double G4LogConsts::LOG_UPPER_LIMIT = 1e307

Definition at line 74 of file G4Log.hh.

Referenced by G4Log().

◆ LOGF_LOWER_LIMIT

const G4float G4LogConsts::LOGF_LOWER_LIMIT = 0

Definition at line 269 of file G4Log.hh.

Referenced by G4Logf().

◆ LOGF_UPPER_LIMIT

const G4float G4LogConsts::LOGF_UPPER_LIMIT = MAXNUMF

Definition at line 268 of file G4Log.hh.

Referenced by G4Logf().

◆ MAXNUMF

const G4float G4LogConsts::MAXNUMF = 3.4028234663852885981170418348451692544e38f

Definition at line 78 of file G4Log.hh.

◆ PX1logf

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

Definition at line 271 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX2logf

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

Definition at line 272 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX3logf

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

Definition at line 273 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX4logf

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

Definition at line 274 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX5logf

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

Definition at line 275 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX6logf

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

Definition at line 276 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX7logf

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

Definition at line 277 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX8logf

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

Definition at line 278 of file G4Log.hh.

Referenced by get_log_poly().

◆ PX9logf

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

Definition at line 279 of file G4Log.hh.

Referenced by get_log_poly().

◆ SQRTH

const G4double G4LogConsts::SQRTH = 0.70710678118654752440

Definition at line 77 of file G4Log.hh.

Referenced by G4Log().

◆ SQRTHF

const G4float G4LogConsts::SQRTHF = 0.707106781186547524f

Definition at line 302 of file G4Log.hh.

Referenced by G4Logf().