Are there any C++11 constexpr
constants which can be used instead of the constant macros from <cmath>
, i.e. constants like M_PI
and friends? Or lacking that, any global const
values which provide these constants at runtime?
M_PI
is a common extension, but not part of standard C++.
Since C++20, mathematical constants such as std::numbers::pi
are defined in the <numbers>
header file. They are all declared constexpr
.