Rappresenting infinite

Robert Kern robert.kern at gmail.com
Fri Jun 29 00:20:30 EDT 2007


mmanns at gmx.net wrote:
> 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.

It is.

> Does it differ from the
> built-in inf?

What 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).

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

> Ideally, it would not be of type float and work with gmpy mpq.
> But I might have rare requirements...

Possibly.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list