mirror of https://github.com/lammps/lammps.git
make certain, that -log() doesn't overflow and assign a suitable maximum number instead.
This commit is contained in:
parent
2fb666dc69
commit
400ef87c05
|
@ -49,7 +49,12 @@ double FixTempCSVR::gamdev(const int ia)
|
||||||
x=1.0;
|
x=1.0;
|
||||||
for (j=1; j<=ia; j++)
|
for (j=1; j<=ia; j++)
|
||||||
x *= random->uniform();
|
x *= random->uniform();
|
||||||
x = -log(x);
|
|
||||||
|
// make certain, that -log() doesn't overflow.
|
||||||
|
if (x < 2.2250759805e-308)
|
||||||
|
x = 708.4;
|
||||||
|
else
|
||||||
|
x = -log(x);
|
||||||
} else {
|
} else {
|
||||||
restart:
|
restart:
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in New Issue