Multiplication of unbalanced operands

Marco Bodrato bodrato at mail.dm.unipi.it
Wed Nov 22 18:53:53 CET 2006


Dear Paul,

On Wed, 22 Nov 2006 18:20:00 +0100, Paul Zimmermann wrote
> Marco and Alberto give an efficient way of implementing the 3:2 case,
> using 0, infinity, 1 and -1 as evaluation points. Let v0, vinf, v1 and vm1

In the preprint we did not care much about signs and other details...
Now I'd suggest some little modifications:

Start: a0+ a1*x + a2*x^2 ; b0 + b1*x

Eval: (exactly the same)
v0  = a0*b0              #c0
v1  = (a0+a1+a2)*(b0+b1) #c0+c1+c2+c3
vm1 = (a0-a1+a2)*(b0-b1) #c0-c1+c2-c3 (this can be negative)
vinf= b1*a2              #c3

Interpolation: (all intermediate results are positive)
vm1 <- (v1-vm1) / 2 # c0+c2
v1  <- v1-vm1-vinf  # c1 
vm1 <- vm1 - v0     # c2 

Regards,
Marco

--
http://bodrato.it/


More information about the gmp-devel mailing list