Replace uses of non-standard M_PI by C++20 std::numbers::pi?
In the ns-3 codebase, most uses of the PI math constant uses the `M_PI` non-standard macro from the `math.h` library. Although it is widely supported by most compilers, it is not standard. C++20 added the [std::numbers](https://en.cppreference.com/w/cpp/symbol_index/numbers) library, which provides many standardized math constants with maximum precision. This issue intends to collect feedback about considering replacing all uses of the non-standard `M_PI` constant by `std::numbers::pi`. ### NOTES 1. In places where the PI constant is used multiple times, it can be convenient to use shorter names to improve the code readability and keeping the lines short. This can be achieved by two methods: ```cpp // --- METHOD 1: Import the definition of pi --- // using std::numbers::pi; // 'pi' is now valid in this scope double perimeter = 2 * pi * radius; // --- METHOD 2: Declare an alias of pi --- // constexpr auto PI = std::numbers::pi; double perimeter = 2 * PI * radius; ``` 2. Unlike `M_PI_2`, there is no built-in definition of PI^2. Still, since the `std::numbers::pi` is `constexpr`, the squared value can be calculated in compile-time. In order to improve the readability, the tricks explained in point 1 can also be applied in this case. Specifically, the following alias can be declared where needed: ```cpp constexpr auto PI2 = std::numbers::pi * std::numbers::pi; ```
issue