Skip to content

Commit

Permalink
Replace workaround macro with new numeric_limits
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Jul 29, 2024
1 parent ae553a1 commit a520aa4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 3 additions & 3 deletions include/boost/math/policies/error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error(
#else
raise_error<std::domain_error, T>(function, message, val);
// we never get here:
return BOOST_MATH_QUIET_NAN(T);
return boost::math::numeric_limits<T>::quiet_NaN();
#endif
}

Expand All @@ -224,7 +224,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error(
{
// This may or may not do the right thing, but the user asked for the error
// to be ignored so here we go anyway:
return BOOST_MATH_QUIET_NAN(T);
return boost::math::numeric_limits<T>::quiet_NaN();
}

template <class T>
Expand All @@ -237,7 +237,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error(
errno = EDOM;
// This may or may not do the right thing, but the user asked for the error
// to be silent so here we go anyway:
return BOOST_MATH_QUIET_NAN(T);
return boost::math::numeric_limits<T>::quiet_NaN();
}

template <class T>
Expand Down
9 changes: 0 additions & 9 deletions include/boost/math/tools/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,6 @@ namespace boost{ namespace math{
# undef BOOST_MATH_FORCEINLINE
# define BOOST_MATH_FORCEINLINE __forceinline__

// We can't use return std::numeric_limits<T>::quiet_NaN()
# define BOOST_MATH_QUIET_NAN(T) static_cast<T>(NAN);

#elif defined(SYCL_LANGUAGE_VERSION)

# define BOOST_MATH_SYCL_ENABLED SYCL_EXTERNAL
Expand All @@ -706,8 +703,6 @@ namespace boost{ namespace math{
# undef BOOST_MATH_FORCEINLINE
# define BOOST_MATH_FORCEINLINE inline

# define BOOST_MATH_QUIET_NAN(T) static_cast<T>(NAN);

#endif

#ifndef BOOST_MATH_CUDA_ENABLED
Expand All @@ -718,10 +713,6 @@ namespace boost{ namespace math{
# define BOOST_MATH_SYCL_ENABLED
#endif

#ifndef BOOST_MATH_QUIET_NAN
# define BOOST_MATH_QUIET_NAN(T) std::numeric_limits<T>::quiet_NaN();
#endif

// Not all functions that allow CUDA allow SYCL (e.g. Recursion is disallowed by SYCL)
# define BOOST_MATH_GPU_ENABLED BOOST_MATH_CUDA_ENABLED BOOST_MATH_SYCL_ENABLED

Expand Down

0 comments on commit a520aa4

Please sign in to comment.