cccl icon indicating copy to clipboard operation
cccl copied to clipboard

[FEA]: constexpr log functions

Open RAMitchell opened this issue 2 months ago • 3 comments

Is this a duplicate?

  • [x] I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct

Area

libcu++

Is your feature request related to a problem? Please describe.

I was blocked making std::normal_distribution constexpr because cuda::std::log is not yet constexpr. This is part of C++26.

Describe the solution you'd like

.

Describe alternatives you've considered

No response

Additional context

No response

RAMitchell avatar Nov 12 '25 09:11 RAMitchell

we do have constexpr ilogb is that sufficient for you?

constexpr math functions are out of our hands because the generally need compiler and runtime support

miscco avatar Nov 12 '25 09:11 miscco

I need natural log unfortunately. Is it theoretically possible to use std::is_constant_evaluated() to "overload" for constexpr?

RAMitchell avatar Nov 12 '25 11:11 RAMitchell

There are some things we can do, but there are issues wrt to denormals, so I would not hold my breath

miscco avatar Nov 12 '25 13:11 miscco