Karatsuba digit-operation cost explains eventual scaling, while a practical base-case threshold depends on the costs of addition, subtraction, copying and function calls relative to small integer multiplication. Using for a base-case cost, one Karatsuba level costs : the quadratic coefficient falls to , but the linear contribution includes . Small operands can therefore cost more despite the smaller exponent. This comparison and the effect of implementation improvements on the threshold are described in the GMP manual.[ref]
The plotted crossover belongs only to the stipulated constants in its caption; its ordinary-method curve counts digit products alone, while the Karatsuba curve includes the chosen internal overhead. Selecting a threshold for real software requires measuring the actual implementation on its intended machine. With base for a fixed machine digit width , the same analysis counts machine digits; it does not establish a universal crossover in decimal digits, bits, or elapsed time.

Articles by others on the same topic (NaN)

There are currently no matching articles.