diff --git a/include/boost/math/ccmath/floor.hpp b/include/boost/math/ccmath/floor.hpp index fa071e24b..fb1dea34d 100644 --- a/include/boost/math/ccmath/floor.hpp +++ b/include/boost/math/ccmath/floor.hpp @@ -15,6 +15,7 @@ #include #include #include +#include namespace boost::math::ccmath { @@ -23,6 +24,13 @@ namespace detail { template inline constexpr T floor_pos_impl(T arg) noexcept { + constexpr auto max_comp_val = T(1) / std::numeric_limits::epsilon(); + + if (arg >= max_comp_val) + { + return arg; + } + T result = 1; if(result < arg)