3 ms·
The dependency is unavoidable due to the way addition works. The approach in the article only works if you are adding a lot of numbers together, and then indee
by devit 6y ago
The dependency is unavoidable due to the way addition works.
The approach in the article only works if you are adding a lot of numbers together, and then indeed doing carry propagation once at the end is obviously faster.
But of course there is no way that doing the carry propagation yourself on one addition can possibly be faster on a decent CPU that implements add-with-carry efficienly.
- jeffdavis 6y agoMaybe it's worth considering an interface to a big int library that can defer carry work across many operations, and then normalizing at the end? That certainly sounds useful for, e.g., totaling an array of big integers.