[libcxx-commits] [libcxx] [libc++][NFC] Rearrange functions in the synopsis comments of `<cmath>` (PR #100862)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jul 27 09:49:52 PDT 2024
PaulXiCao wrote:
The previous order was (almost?) an exact copy of the standard I believe (e.g. see https://eel.is/c++draft/c.math.syn). I see benefits to sticking to that order instead of defining a new one which might not be adhered to by new contributors.
Nonetheless, there are things to update, e.g.
```cpp
//
// from main
//
floating_point hypot (arithmetic x, arithmetic y);
float hypotf(float x, float y);
long double hypotl(long double x, long double y);
double hypot(double x, double y, double z); // C++17
float hypot(float x, float y, float z); // C++17
long double hypot(long double x, long double y, long double z); // C++17
//
// from the standard
//
constexpr floating-point-type hypot(floating-point-type x, floating-point-type y);
constexpr float hypotf(float x, float y);
constexpr long double hypotl(long double x, long double y);
// [[c.math.hypot3]](https://eel.is/c++draft/c.math.hypot3), three-dimensional hypotenuse
constexpr floating-point-type hypot(floating-point-type x, floating-point-type y,
floating-point-type z);
```
I would also include `constexpr` as long as we support it.
I do not have an opinion yet what to do about the comments and links therein (e.g. `// [[c.math.hypot3]](https://eel.is/c++draft/c.math.hypot3), three-dimensional hypotenuse`). Not sure if there is really a benefit if we also include those.
https://github.com/llvm/llvm-project/pull/100862
More information about the libcxx-commits
mailing list