From a1b737c049bb297d5e4ec80cd5335d1382ce623a Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Sat, 14 Dec 2019 11:07:35 -0500 Subject: efficiency tuning: don't evaluate the exponential when we don't have to --- lib/wolff.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') 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) { -- cgit v1.2.3-70-g09d2