[libcxx] `std::numbers::pi_v<long double>` uses `double` precision instead of `long double` precision
Open
libc++
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://godbolt.org/z/d5rbzM9af (I copy pasted https://github.com/llvm/llvm-project/blob/main/libcxx/include/numbers for this test)
`std::numbers::pi_v` returns the value of `(long double)(3.14159)` instead of `3.14159L`. This means that the value of `std::numbers::NUMBER_v` is **not** the correctly rounded value on targets where `long double` has more precision than `double`.
One fix would be to use `long double` literals, but this problem arises again since `std::numbers::pi_v<__float128>` or etc would be rounded to `long double` precision. So we may have to add these constants for all supported floating point types wider than `long double`.
Contributor guide
Assessment
This issue has not been assessed yet.