https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82749
--- Comment #13 from Tomasz KamiĆski <tkaminsk at gcc dot gnu.org> --- After researching, I do not believe that storing the actual result_type inside a piecewise distribution is possible without breaking the ABI. My initial idea of expanding _M_cp to store additional values proved to be a breaking change; the operator() of both distributions invokes a lower bound search on the range [_M_cp.begin(), _M_cp.end()). Consequently, expanding _M_cp would violate the preconditions of this function. Furthermore, beyond the ABI break, this would also constitute a behavioral change. Beyond the obvious changes to result values due to increased or decreased precision, we might generate entirely different values and alter the number of generator calls. Distributions currently always generate double values using the provided random generator. Adjusting the generator to use a smaller or larger type will change the number of calls performed per value. Consequently, I think that for float, long double, and __float128, we cannot change the type used for computation and stored inside vector members. However, for std::floatNN_t types, the ABI is not yet stable, and using them with distributions is IF-NDR (or implementation-defined as of C++26), we could fix the result type there. Therefore, I suggest introducing a __piecewise_comp_t to be used for both storage and computation. We then specialize it for float, long double (if the size differs from double), and __float128 to continue using double. These could be provided under a compilation flag for users who are not concerned about the ABI stability of these components.
