Skip to content

Commit

Permalink
Fix warning C4146: unary minus operator applied to unsigned type
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Oct 29, 2022
1 parent aa25b04 commit 548118a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/boost/math/ccmath/isinf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
namespace boost::math::ccmath {

template <typename T>
inline constexpr bool isinf(T x)
constexpr bool isinf(T x) noexcept
{
if(BOOST_MATH_IS_CONSTANT_EVALUATED(x))
{
return x == std::numeric_limits<T>::infinity() || -x == std::numeric_limits<T>::infinity();
if constexpr (std::is_signed_v<T>)
{
return x == std::numeric_limits<T>::infinity() || -x == std::numeric_limits<T>::infinity();
}
else
{
return x == std::numeric_limits<T>::infinity();
}
}
else
{
Expand Down

0 comments on commit 548118a

Please sign in to comment.