2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Use identity function in floor if val >= 1/epsilon

This commit is contained in:
Matt Borland
2023-11-16 11:26:41 +01:00
parent 8da51f2bde
commit fe377373e4

View File

@@ -15,6 +15,7 @@
#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
#include <limits>
namespace boost::math::ccmath {
@@ -23,6 +24,13 @@ namespace detail {
template <typename T>
inline constexpr T floor_pos_impl(T arg) noexcept
{
constexpr auto max_comp_val = T(1) / std::numeric_limits<T>::epsilon();
if (arg >= max_comp_val)
{
return arg;
}
T result = 1;
if(result < arg)