Rappresenting infinite

mmanns at gmx.net mmanns at gmx.net
Thu Jun 28 23:46:18 EDT 2007


On Wed, 27 Jun 2007 11:59:29 -0000
Rob De Almeida <ralmeida at gmail.com> wrote:

> On Jun 27, 6:41 am, andrea <kerny... at gmail.com> wrote:
> > I would like to have a useful rappresentation of infinite, is there
> > already something??
> 
> from numpy import 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.
>>> from numpy import inf
>>> inf == inf
True
>>> type(inf)
<type 'float'>


This looks like the floating point inf to me. Does it differ from the
built-in inf?

I would like to second the OP's question if there is a generic inf and
add the wish that that is not equal to itself (inf == inf would yield
nan). Ideally, it would not be of type float and work with gmpy mpq.
But I might have rare requirements...

Martin



More information about the Python-list mailing list