Skip to content

Commit

Permalink
Replace C style asserts with BOOST_MATH_ASSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Nov 16, 2023
1 parent 6aaba2e commit 2cb550d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/ccmath_ceil_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ constexpr void test()

constexpr T half_max_ceil = boost::math::ccmath::ceil(T((std::numeric_limits<T>::max)() / 2));
static_assert(half_max_ceil == (std::numeric_limits<T>::max)() / 2);
assert(half_max_ceil == std::ceil((std::numeric_limits<T>::max)() / 2));
BOOST_MATH_ASSERT(half_max_ceil == std::ceil((std::numeric_limits<T>::max)() / 2));

constexpr T third_max_ceil = boost::math::ccmath::ceil(T((std::numeric_limits<T>::max)() / 3));
static_assert(third_max_ceil == (std::numeric_limits<T>::max)() / 3);
assert(third_max_ceil == std::ceil((std::numeric_limits<T>::max)() / 3));
BOOST_MATH_ASSERT(third_max_ceil == std::ceil((std::numeric_limits<T>::max)() / 3));

constexpr T one_over_eps = boost::math::ccmath::ceil(1 / T(std::numeric_limits<T>::epsilon()));
static_assert(one_over_eps == 1 / T(std::numeric_limits<T>::epsilon()));
assert(one_over_eps != std::ceil(1 / T(std::numeric_limits<T>::epsilon())))
BOOST_MATH_ASSERT(one_over_eps == std::ceil(1 / T(std::numeric_limits<T>::epsilon())));
}

#if !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) && !defined(BOOST_MATH_USING_BUILTIN_CONSTANT_P)
Expand Down
6 changes: 3 additions & 3 deletions test/ccmath_floor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ constexpr void test()

constexpr T half_max_floor = boost::math::ccmath::floor(T((std::numeric_limits<T>::max)() / 2));
static_assert(half_max_floor == (std::numeric_limits<T>::max)() / 2);
assert(half_max_floor == std::floor((std::numeric_limits<T>::max)() / 2));
BOOST_MATH_ASSERT(half_max_floor == std::floor((std::numeric_limits<T>::max)() / 2));

constexpr T third_max_floor = boost::math::ccmath::floor(T((std::numeric_limits<T>::max)() / 3));
static_assert(third_max_floor == (std::numeric_limits<T>::max)() / 3);
assert(third_max_floor == std::floor((std::numeric_limits<T>::max)() / 3));
BOOST_MATH_ASSERT(third_max_floor == std::floor((std::numeric_limits<T>::max)() / 3));

constexpr T one_over_eps = boost::math::ccmath::floor(1 / T(std::numeric_limits<T>::epsilon()));
static_assert(one_over_eps == 1 / T(std::numeric_limits<T>::epsilon()));
assert(one_over_eps == std::floor(1 / T(std::numeric_limits<T>::epsilon())));
BOOST_MATH_ASSERT(one_over_eps == std::floor(1 / T(std::numeric_limits<T>::epsilon())));
}

#if !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) && !defined(BOOST_MATH_USING_BUILTIN_CONSTANT_P)
Expand Down

0 comments on commit 2cb550d

Please sign in to comment.