Skip to content

Commit

Permalink
Merge pull request #858 from mborland/warnings
Browse files Browse the repository at this point in the history
Fix warning 4146 and 4244 in ccmath
  • Loading branch information
mborland authored Oct 30, 2022
2 parents aa25b04 + 94201a8 commit adc6dca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 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::numeric_limits<T>::is_signed)
{
return x == std::numeric_limits<T>::infinity() || -x == std::numeric_limits<T>::infinity();
}
else
{
return x == std::numeric_limits<T>::infinity();
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion include/boost/math/ccmath/logb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ inline constexpr T logb_impl(T arg) noexcept
int exp = 0;
boost::math::ccmath::frexp(arg, &exp);

return exp - 1;
return static_cast<T>(exp - 1);
}

} // Namespace detail
Expand Down

0 comments on commit adc6dca

Please sign in to comment.