mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Fix constexpr cmath floor of 1 returning 0 #1232
This commit is contained in:
@@ -33,7 +33,7 @@ inline constexpr T floor_pos_impl(T arg) noexcept
|
||||
|
||||
T result = 1;
|
||||
|
||||
if(result < arg)
|
||||
if(result <= arg)
|
||||
{
|
||||
while(result < arg)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ constexpr void test()
|
||||
static_assert(boost::math::ccmath::isinf(boost::math::ccmath::floor(-std::numeric_limits<T>::infinity())),
|
||||
"If x is +- inf, it is returned, unmodified");
|
||||
|
||||
static_assert(boost::math::ccmath::floor(T(1.0)) == T(1.0));
|
||||
static_assert(boost::math::ccmath::floor(T(2)) == T(2));
|
||||
static_assert(boost::math::ccmath::floor(T(2.4)) == T(2));
|
||||
static_assert(boost::math::ccmath::floor(T(2.9)) == T(2));
|
||||
|
||||
Reference in New Issue
Block a user