Arbitrary precision calculations
Timothy R Evans
tre17 at pc142.cosc.canterbury.ac.nz
Tue Jun 29 19:05:42 EDT 1999
catlee at my-deja.com writes:
> Hi,
>
> I'm looking for a package that will let me do arbitrary precision
> arithmatic in python. I've come across the real.py module written by
> Jurjen N.E. Bos, and it seems like a really nice module except for the
> fact that you can't compare two numbers for equality,inequality,etc.
>
> Cheers,
> Chris
>
> P.S. I found the real.py package by doing a search on www.deja.com for
> arbirary precision in comp.land.python
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
If I'm reading this right you want arbitrary precision integers right?
Just use the Python `Long' integer, created using the `long' function
or by placing an L after a literal number (e.g. 10L). All standard
numerical operators ork on long intergers (if you're doing crypto
stuff then don't forget that `pow(X,Y,Z)' calucates X to the power of
Y, modulo Z efficiently.
--
Tim Evans
More information about the Python-list
mailing list