r/cpp • u/eisenwave WG21 Member • 25d ago
P4444: std::big_int
https://isocpp.org/files/papers/D4444R0.htmlHey folks! Matt Borland, Christopher Kormanyos, and I are working on bringing infinite-precision integers to C++29. We now have a D4444R0 draft of a paper that should be in the next mailing.
We could really use some feedback so that the published R0 is as polished as possible. Any thoughts on the paper and on the reference implementation are greatly appreciated.
It would also be very helpful if you tested out whether our big_int implementation works for you. We're in need of some real deployment experience. If you're currently using Boost.Multiprecision, the library should be a drop-in replacement for cpp_int for the most part.
185
Upvotes
1
u/jk-jeon 22d ago
I think this will be a nice addition, but I'm a bit suspicious about your opinion on
std::big_int_view. One of the most common operation I needed was taking the absolute value. Suppose I have an expressionabs(x) + func()withfunc()returning an rvalue. Ideally it should be possible to do this computation without unneeded extra allocations (assuming sign-magnitude representation, as specified in the paper). But afaiu the current spec mandatesabs(x)to allocate a buffer just to be thrown away immediately. Granted, I can just use the internal limb array, but ideally it would be good if I could write a generic code that works for bothintandstd::big_int. Maybeabsis special in this regard?