GMP division plans

Paul Zimmermann Paul.Zimmermann at
Tue Apr 4 21:53:07 CEST 2006

> And if you really, *really* want squaring then it can be very easily
> implemented as  n^2 =3D (n+1)(n-1) + 1.  Sounds good to me.  Increments
> and decrements are very cheap operations.

I disagree. On the contrary I suggest to remove multiplication and to only
provide squaring. Users who really want to perform non-square products can
still compute them as [(a+b)^2-(a-b)^2] >> 2. Future versions of GMP might
include some addsub instruction to make this computation very efficient.

Paul Z.

More information about the gmp-discuss mailing list