diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 048c5becee9..13b02adec19 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -476,6 +476,9 @@ typedef int FPU_CW_t; #define CGAL_FE_DOWNWARD FE_DOWNWARD #endif +#define CGAL_FE_ROUNDING_MASK ((CGAL_FE_TONEAREST | CGAL_FE_TOWARDZERO | CGAL_FE_UPWARD | CGAL_FE_DOWNWARD) \ + & ~(CGAL_FE_TONEAREST & CGAL_FE_TOWARDZERO & CGAL_FE_UPWARD & CGAL_FE_DOWNWARD)) // mask for rounding bits + // User interface: inline @@ -484,7 +487,8 @@ FPU_get_cw (void) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST CGAL_assertion_code(FPU_CW_t cw; CGAL_IA_GETFPCW(cw);) - CGAL_assertion(cw == CGAL_FE_TONEAREST); + CGAL_assertion_code(FPU_CW_t mask = CGAL_FE_ROUNDING_MASK;) + CGAL_assertion((cw & mask) == (CGAL_FE_TONEAREST & mask)); return CGAL_FE_TONEAREST; #else FPU_CW_t cw; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h index 29d4d5810bb..1c47b6275d3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h @@ -34,6 +34,7 @@ #include #include + #if defined(CGAL_METIS_ENABLED) #include #endif // CGAL_METIS_ENABLED @@ -42,14 +43,16 @@ #include #include #endif // CGAL_LINKED_WITH_TBB +#if defined(CGAL_LINKED_WITH_TBB) && defined(CGAL_METIS_ENABLED) && defined(USE_PARALLEL_BEHD) +# include +#endif -#include - -#include #include #include #include #include +#include +#include #ifdef CGAL_HAUSDORFF_DEBUG_PP #ifndef CGAL_HAUSDORFF_DEBUG @@ -1467,7 +1470,11 @@ bounded_error_squared_Hausdorff_distance_impl(const TriangleMesh1& tm1, using Candidate = Candidate_triangle; - CGAL_precondition(sq_initial_bound >= square(FT(error_bound))); + if constexpr(std::is_floating_point_v) { + CGAL_precondition(std::nextafter(sq_initial_bound, (std::numeric_limits::max)()) >= square(FT(error_bound))); + } else { + CGAL_precondition(sq_initial_bound >= square(FT(error_bound))); + } CGAL_precondition(sq_distance_bound != FT(0)); // value is -1 if unused CGAL_precondition(tm1_tree.size() > 0); CGAL_precondition(tm2_tree.size() > 0);