How to represent the infinite ?

Donn Cave donn at u.washington.edu
Thu Jun 20 13:52:38 EDT 2002


Quoth Christophe Delord <christophe.delord at free.fr>:
|
| There is another simple solution. Just use a float that is bigger than any 64-bit float. For example 10^1000. This float has a special encoding meaning +oo !
| So no need to redefine anything else ;-)
|
| >>> x=1e1000
| >>> x
| inf
...
| >>> x-x
| nan

$ python
Python 2.0 (#1, Dec 18 2000, 10:19:52) [C] on osf1V4
Type "copyright", "credits" or "license" for more information.
>>> x = 1e1000
>>> x
1.7976931348623157e+308
>>> x > 10
1
>>> x - x
0.0
>>>

I missed the original post, hope this helps.

	Donn Cave, donn at u.washington.edu

| > Not need to say to me that I can use 99999999999999 or -99999999999999 or I
| > do not know what.
| > Nor from a MAX_INT of the machine... bus Python can go higher.
| > 
|
|
|
|
| -- 
|
| (o_   Christophe Delord                   _o)
| //\   http://christophe.delord.free.fr/   /\\
| V_/_  mailto:christophe.delord at free.fr   _\_V



More information about the Python-list mailing list