Skip to content

Commit 548118a

Browse files
committed
Fix warning C4146: unary minus operator applied to unsigned type
1 parent aa25b04 commit 548118a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

include/boost/math/ccmath/isinf.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,18 @@
1414
namespace boost::math::ccmath {
1515

1616
template <typename T>
17-
inline constexpr bool isinf(T x)
17+
constexpr bool isinf(T x) noexcept
1818
{
1919
if(BOOST_MATH_IS_CONSTANT_EVALUATED(x))
2020
{
21-
return x == std::numeric_limits<T>::infinity() || -x == std::numeric_limits<T>::infinity();
21+
if constexpr (std::is_signed_v<T>)
22+
{
23+
return x == std::numeric_limits<T>::infinity() || -x == std::numeric_limits<T>::infinity();
24+
}
25+
else
26+
{
27+
return x == std::numeric_limits<T>::infinity();
28+
}
2229
}
2330
else
2431
{

0 commit comments

Comments
 (0)