summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/wolff.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/wolff.hpp b/lib/wolff.hpp
index d21d788..23df10c 100644
--- a/lib/wolff.hpp
+++ b/lib/wolff.hpp
@@ -239,7 +239,11 @@ namespace wolff{
}
#ifndef WOLFF_USE_FINITE_STATES
- p = 1.0 - exp(-dE / T);
+ if (dE < 0) {
+ p = 0;
+ } else {
+ p = 1.0 - exp(-dE / T);
+ }
#endif
if (dist(rng) < p) {