diff --git a/Src/Base/AMReX_RKIntegrator.H b/Src/Base/AMReX_RKIntegrator.H index a6efd02853..97ad4284f2 100644 --- a/Src/Base/AMReX_RKIntegrator.H +++ b/Src/Base/AMReX_RKIntegrator.H @@ -251,7 +251,8 @@ public: for (int step_number = 0; step_number < BaseT::max_steps && !stop; ++step_number) { // Adjust step size to reach output time - if (time_out - time_current < dt) { + // protect against roundoff + if (std::abs(time_out - time_current - dt) <= 1.e5 * std::numeric_limits::epsilon() * std::abs(dt)) { dt = time_out - time_current; stop = true; }