From c007f10c28e51db49a984719350fcc37418caade Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Tue, 7 Aug 2018 16:24:46 +0200 Subject: [PATCH] [timeloop][fix] Revise floating point number comparison --- dumux/common/timeloop.hh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh index 5d91a3865e..d11e43ea86 100644 --- a/dumux/common/timeloop.hh +++ b/dumux/common/timeloop.hh @@ -281,8 +281,7 @@ public: */ bool finished() const { - using std::abs; - return finished_ || abs(time_-endTime_)/endTime_ < 1e-14; + return finished_ || endTime_-time_ < 1e-10*time_; } /*! @@ -291,8 +290,7 @@ public: */ bool willBeFinished() const { - using std::abs; - return finished_ || abs(time_+timeStepSize_-endTime_)/endTime_ < 1e-14; + return finished() || endTime_-time_-timeStepSize_ < 1e-10*timeStepSize_; } /*! -- GitLab