oscbyspro / AwesomeNumbersKit

Large number arithmetic in Swift
Apache License 2.0
7 stars 1 forks source link

Galaxy-brain radix exponentiation #144

Closed oscbyspro closed 1 year ago

oscbyspro commented 1 year ago

From https://github.com/oscbyspro/Numberick/issues/22

As it turns out, you can square the radix a bunch of times and then merge the squares. In the case where the radix is 3 (the worst case scenario), the number of multiplications required to create an AnyRadixUIntRoot instance is reduced from 40 to 11 on 64-bit machines. Similarly, this number goes from 19 to 9 when the radix is 10. So, that's nice.