36-math.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. diff --git a/include/__math/rounding_functions.h b/include/__math/rounding_functions.h
  2. index 29e42fd..7943b6f 100644
  3. --- a/include/__math/rounding_functions.h
  4. +++ b/include/__math/rounding_functions.h
  5. @@ -204,7 +204,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI double rint(_A1 __x) _NOEXCEP
  6. // round
  7. -_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { return __builtin_round(__x); }
  8. +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { return __builtin_roundf(__x); }
  9. template <class = int>
  10. _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT {
  11. @@ -222,7 +222,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI double round(_A1 __x) _NOEXCE
  12. // trunc
  13. -_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { return __builtin_trunc(__x); }
  14. +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { return __builtin_truncf(__x); }
  15. template <class = int>
  16. _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT {
  17. diff --git a/include/math.h b/include/math.h
  18. index 0598973..376bbf7 100644
  19. --- a/include/math.h
  20. +++ b/include/math.h
  21. @@ -290,6 +290,9 @@ float truncf(float x);
  22. long double truncl(long double x);
  23. */
  24. +# ifdef __CUDACC__
  25. +# include <math_cuda.h>
  26. +# else
  27. # include <__config>
  28. @@ -323,7 +326,7 @@ extern "C++" {
  29. # undef isinf
  30. # endif
  31. -# ifdef isnan
  32. +# if defined(isnan) && !defined(_LIBCPP_MSVCRT)
  33. # undef isnan
  34. # endif
  35. @@ -503,6 +506,8 @@ using std::__math::trunc;
  36. # endif // __cplusplus
  37. +# endif // __CUDACC__
  38. +
  39. #else // _LIBCPP_MATH_H
  40. // This include lives outside the header guard in order to support an MSVC