From a40b023228709058a0b71a2b2c0c873a6d33a7c0 Mon Sep 17 00:00:00 2001
From: Sebastien Ponce <sebastien.ponce@cern.ch>
Date: Tue, 5 Sep 2023 16:49:00 +0200
Subject: [PATCH] Fixed float comparisons in CPUCruncher.cpp

---
 GaudiHive/src/CPUCruncher.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/GaudiHive/src/CPUCruncher.cpp b/GaudiHive/src/CPUCruncher.cpp
index d7f6ffe124..2e10d1d518 100644
--- a/GaudiHive/src/CPUCruncher.cpp
+++ b/GaudiHive/src/CPUCruncher.cpp
@@ -59,7 +59,7 @@ StatusCode CPUCruncher::initialize() {
   }
 
   // if an algorithm was setup to sleep, for whatever period, it effectively models CPU-blocking behavior
-  if ( m_sleepFraction != 0.0f ) setBlocking( true );
+  if ( abs( m_sleepFraction ) > std::numeric_limits<float>::epsilon() ) setBlocking( true );
 
   // This is a bit ugly. There is no way to declare a vector of DataObjectHandles, so
   // we need to wait until initialize when we've read in the input and output key
@@ -140,7 +140,7 @@ StatusCode CPUCruncher::execute() // the execution of the algorithm
       do {
         unif1 = getUnifRandom( seed );
         unif2 = getUnifRandom( seed );
-      } while ( unif1 == 0. );
+      } while ( unif1 < std::numeric_limits<double>::epsilon() );
 
       const double normal = sqrt( -2. * log( unif1 ) ) * cos( 2 * M_PI * unif2 );
 
-- 
GitLab