r/cpp • WG21 Member • Aug 18 '26

P4444: std::big_int

https://isocpp.org/files/papers/D4444R0.html

Hey 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.

180 Upvotes

85 comments sorted by

View all comments

Show parent comment

20

u/vip17 Aug 18 '26

if there hardware capabilities and portablity issues that aren't easy to resolve, then fix those in the standard to allow people to implement libraries

There's no way to expose hardware features consistently for all big int libraries to use. Each hardware has vastly different features, for example in x86 there's ADX to do two add/mul chains in parallel for big int, and for even bigger values AVX2/AVX-512 can be used. Many other architectures don't have carry flags, some have separate instructions to get the high bits of the multiplication, some have FFT accelerator for FFT big int, some others like ARM SVE2 have SIMD add with carry flag from other lanes. There are already intrinsics that libraries have to use anyway. Replacing the library interface is always a better choice

7

u/styczynski_meow Aug 18 '26 edited Aug 18 '26

std::simd situation 2.0

Committee pleeease can I get just one standard library extension this one time? Pleaaaaaase to provide clean interface for a clean code!

Actually uses it to introduce messy abstraction nobody use like a boss 🗿
/s