2**HUGENUMBER Why not optimise it?

Michael Hudson mwh at python.net
Fri May 24 09:32:55 EDT 2002


jepler at unpythonic.net writes:

> On Fri, May 24, 2002 at 10:06:12AM +0000, Michael Hudson wrote:
> > Christian Tismer <tismer at tismer.com> writes:
> > 
> > > Michael Hudson wrote:
> > > > Do you feel like implementing Karatsuba multiplication in
> > > > longobject.c?  That might actually be some use...
> > > 
> > > Although this was on the table two or three years ago,
> > 
> > I know.  I remember.  That thread was probably the first place I heard
> > of Karatsuba multiplication...
> 
> The message you're looking for may be in a thread from July 1999:
[snip megaurl]

Yep that's the one.  I'd already found it (not very hard -- google for
Karatsuba on comp.lang.python...).  Good reading, though, so anyone
else out there should read it too!

> It'd be a bit nicer now that the builtin "long" class can be subclassed.

That's a point.

> Too bad you can't write
>     long.__mul__ = karatsuba_mul
> or
>     long = karatsuba_long
> and have it "work" (longs constructed in the easy way, 'x=1L', would have
> karatsuba multiplication behavior by default)

I think overall I'd glad you can't do things like that...

Cheers,
M.

-- 
  If you give someone Fortran, he has Fortran.
  If you give someone Lisp, he has any language he pleases.
    -- Guy L. Steele Jr, quoted by David Rush in comp.lang.scheme.scsh



More information about the Python-list mailing list