usage of mpz_mul function for squaring

Paul Zimmermann Paul.Zimmermann at
Tue Nov 30 08:39:29 UTC 2021

       Dear Gasper,

> The other question I have is about the speed of squaring a N limb operand
> compared to multiplying two different N limb operands. In the Basecase
> Multiplication section of Manual it is stated that squaring is about 1.5x
> faster than multiplying. I'm assuming squaring is also faster than
> multiplication when other algorithms are used (Karatsuba, Toom, FFT, ...)
> since they rely on basecase multiplication and also use a different
> calculation procedure for squaring. Is my assumption correct?

this is discussed in Section 1.3.6 of "Modern Computer Arithmetic",
including the mention of "asymmetric squaring".

Best regards,
Paul Zimmermann

More information about the gmp-discuss mailing list