- 
    Task 
- 
    Resolution: Unresolved
- 
    P2: Important 
- 
    None
- 
    None
- 
    None
FP types are supposed to have typed mathematical constants in <numbers> (cf. epic). For any std::floating_point T, that is done by the std library. We're not allowed to specialize std::is_floating_point for qfloat16 (that would be UB: https://en.cppreference.com/w/cpp/types/is_floating_point), so the library will not provide these constants for qfloat16 for us. We're allowed (http://eel.is/c++draft/numbers#math.constants-2) to add our own specializations, and that's what we should do.
The problem is that qfixed16(float) isn't constexpr (→ QTBUG-116079), so, like for the existing std::numeric_limits specialization, we need to use the Wrap mechanism, otherwise we could just have said
template <> inline constexpr pi<qfloat16> = qfixed16(pi<float>);
~~~
Acceptance criteria: The following test passes:
#ifndef __cpp_lib_math_constants
    QSKIP("This test requires C++20 <numbers> support enabled in the compiler.");
#else
    using namespace std::numbers;
#define CHECK(constant) \
    QCOMPARE_EQ(qfloat16(std::numbers:: constant ## _v<float>   ), \
                         std::numbers:: constant ## _v<qfloat16>)
    CHECK(e);
    CHECK(log2e);
    CHECK(log10e);
    CHECK(pi);
    CHECK(inv_pi);
    CHECK(ln2);
    CHECK(ln10);
    CHECK(sqrt2);
    CHECK(sqrt3);
    CHECK(inv_sqrt3);
    CHECK(egamma);
    CHECK(phi);
#undef CHECK
#endif // __cpp_lib_math_constants
- relates to
- 
                     QTBUG-116079
        As a user of Qt, I expect qfloat16 construction to be constexpr QTBUG-116079
        As a user of Qt, I expect qfloat16 construction to be constexpr-         
- Withdrawn
 
-