Rappresenting infinite

mmanns at gmx.net mmanns at gmx.net
Fri Jun 29 00:45:42 EDT 2007


On Thu, 28 Jun 2007 23:20:30 -0500
Robert Kern <robert.kern at gmail.com> wrote:

> mmanns at gmx.net wrote:
> > Does it differ from the
> > built-in inf?
> 
> What built-in inf?

$ python
Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1.0e1000
>>> b = 2.0e1000
>>> a
inf
>>> b
inf
>>> a == b
True
>>> type(a)
<type 'float'>



> No. You can make one that fits your requirements, though.

I am struggling to oversee the implications of design choices for inf
behaviour - especially if it comes to comparison with float type inf.
The type in my application contains a gmpy.mpq and a float that is
always kept between -1 and 1 by adding to the mpq on each operation.
I am looking for a robust inf design for this type. (Note: mpq and
float inf do not compare).

Martin



More information about the Python-list mailing list