Date: Mon, 25 Aug 2025 22:55:04 +0200
Perhaps we need bit_cast or other conversions for arrays and templated containers. Either as noop or as actual conversion.
ranges? adapter classes? Do we have enough facilities?
-----Ursprüngliche Nachricht-----
Von:Paul Caprioli <paul_at_[hidden]>
Gesendet:Mo 25.08.2025 22:03
Betreff:RE: [std-proposals] TBAA and extended floating-point types
An:std-proposals_at_[hidden];
CC:Sebastian Wittmeier <wittmeier_at_[hidden]>;
> What about bitcast instead?
I'm thinking about the following, and don't see how bitcast is useful:
void daxpy(std::size_t n, const std::float64_t alpha, const std::float64_t* x,
std::float64_t* y) {
for (std::size_t i = 0; i < n; ++i) y[i] += alpha * x[i];
}
int main() {
std::size_t n = 40;
double alpha = 2.0;
std::vector<double> x(n, 1.0);
std::vector<double> y(n, 3.0);
daxpy(n, alpha, x.data(), y.data());
std::cout << y[17] << '\n'; // UB
}
Received on 2025-08-25 21:05:59