Skip to content

Fix clock comparisons: do not use exact comparisons for floats

Sebastian Ohlmann requested to merge fix_clock_comparison into main

Description

Up to now, the time in the clock_t type has been compared using exact comparisons. However, rounding errors can occur for floating point numbers that make these comparisons faulty. Now, use a tolerance for the relative difference of the time values. It is set to 1e-8 for the moment, but could also be a bit smaller. Also adapt the other comparison functions to take the new equality into account.

Checklist

  • I have checked that my code follows the Octopus coding standards
  • I have added tests for all the new features added in this request.

Merge request reports