Multiprecision arithmetic library question.

casevh casevh at gmail.com
Thu Jun 19 23:43:37 CEST 2008


> No, I do not know that. Define desperate.
> Does Python support the extended Euclidean algorithm
> and other number theory functions?

No.

> How fast does Python multiply?

Python uses the Karatsuba algorithm which O(n^1.585). Division is
still O(n^2).

> Not that the latter is particularly important,
> as C is built for speed.
>
> I've been fooling around. Ran dir(gmpy), and
> it does not show the full complement of GMP
> library functions, such as the various division
> functions. e.g. mpz_tdiv_qr.

gmpy implements the Python numeric model using GMP and exposes some of
the high-level functions. Are you looking for low-level wrapper that
exposes all the GMP library functions?

> --
> Michael Press




More information about the Python-list mailing list