Lossless Number Conversion

Raymond L. Buvel levub137 at wi.rr.com
Mon Aug 29 07:19:58 EDT 2005


Chris Spencer wrote:
> Is there any library for Python that implements a kind of universal
> number object. Something that, if you divide two integers, generates a
> ratio instead of a float, or if you take the square root of a negative,
> generates a complex number instead of raising an exception? Lisp has
> something like this, and it makes number crunching much more convenient.
> 
> Chris

If you are on any Unix-like platform, you might want to check out clnum.
 It works like the gmpy package but has complex versions of rationals
and arbitrary precision floats.

http://calcrpnpy.sourceforge.net/clnum.html



More information about the Python-list mailing list