Overhaul `constexpr <cmath>` by StephanTLavavej · Pull Request #6434 · microsoft/STL · GitHub
Skip to content

Overhaul constexpr <cmath> - #6434

Merged
Stephan T. Lavavej (StephanTLavavej) merged 7 commits into
microsoft:mainfrom
StephanTLavavej:cmath-forever
Sep 4, 2026
Merged

Overhaul constexpr <cmath>#6434
Stephan T. Lavavej (StephanTLavavej) merged 7 commits into
microsoft:mainfrom
StephanTLavavej:cmath-forever

Conversation

@StephanTLavavej

@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) commented Sep 3, 2026

Copy link
Copy Markdown
Member

This PR avoids the need for a whole bunch of workarounds in constexpr <cmath> and should make it possible for /Zc:cmath TUs to coexist with /Zc:cmath- TUs.

  • exp2 is completely ready to be _CONSTEXPR_CMATH26.
  • cmath: Mark float/long double overloads as _CONSTEXPR_CMATH26_NYI; the generic macros already are.
    • This will make it easier to remember to update these overloads in the future.
  • cmath: constexpr inline => constexpr for lerp.
  • Implement the float versions of acosh, asinh, atanh, cosh, sinh, tanh, erf with LLVM libc, making them C++26 constexpr.
    • These are also ready (and we were using some builtins, just not making them constexpr).
  • Instead of declaring MEOWl, define it as wrapping MEOW.
  • Use extern "C" for decls, but extern "C++" with an inline namespace for defns.
    • This should avoid conflicts with the UCRT, while remaining invisible to users. This also avoids intrinsic headaches.
  • Declare UCRT lgamma/tgamma instead of implementing with Boost.Math.

Copilot AI balanced review requested due to automatic review settings September 3, 2026 23:47
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added the enhancement Something can be improved label Sep 3, 2026
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Sep 3, 2026
@azure-pipelines

This comment was marked as resolved.

This comment was marked as resolved.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit eae5df4 into microsoft:main Sep 4, 2026
48 checks passed
@github-project-automation github-project-automation Bot moved this from Final Review to Done in STL Code Reviews Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved high priority Important!

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

special_math.cpp: Investigate lgamma()/tgamma() error behavior

3 participants