[libcxx-commits] [libcxx] [libc++][NFC] Rearrange functions in the synopsis comments of `<cmath>` (PR #100862)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 27 09:59:19 PDT 2024


mordante 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.

The goal is indeed to match the synopsis in the Standard to validate what we have and have not implemented.

> Nonetheless, there are things to update, e.g.
> 
> //
> // 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);

Since we have not implemented `constexpr hypot` (and friends) they should not be marked `constexpr` in the synopsis.
This is our way to determine what the status of our implementation is. Deviations from the Standard should mean we're missing features. This helps tracking the status of larger papers that are partly implemented.

Side note: This may not be the best way, but it's the best we got. We discussed other ideas in the past, but haven't found a better solution.

https://github.com/llvm/llvm-project/pull/100862


More information about the libcxx-commits mailing list