Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libcudacxx/include/cuda/std/__complex/roots.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ template <class _Tp>
// pre-check to see if we over/underflow:
_Tp __x_abs_sq = ::cuda::std::fma(__re, __re, __im * __im);

// NVCC 12.9 seems to be eliminating some parentheses which makes MSVC unhappy.
_CCCL_DIAG_PUSH
#if _CCCL_CUDA_COMPILER(NVCC, <, 13, 0)
_CCCL_DIAG_SUPPRESS_MSVC(4554) // warning C4554: '<<': check operator precedence for possible error; use parentheses
// to clarify precedence
#endif // _CCCL_CUDA_COMPILER(NVCC, <, 13, 0)

// Get some bounds where __re +- |__x| won't overflow.
// Doesn't need to be too exact, enough to cover extremal cases.
// overflow bound = sqrt(MAX_FLOAT / 2)
Expand All @@ -87,6 +94,8 @@ template <class _Tp>
(static_cast<__uint_t>((static_cast<__uint_t>(-__max_exponent + __mant_nbits) >> 1) + __exp_bias) << __mant_nbits)
| __fp_explicit_bit_mask_of_v<_Tp>;

_CCCL_DIAG_POP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the warning suppression outof the function. We have multiple similar bit operations and I dont want that to reappear

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were the only ones triggering it and I'd rather be narrow with silencing like this, to avoid getting false negatives without inspection.


_Tp __overflow_bound = ::cuda::std::__fp_from_storage<_Tp>(__overflow_bound_exp);
_Tp __underflow_bound = ::cuda::std::__fp_from_storage<_Tp>(__underflow_bound_exp);

Expand Down