Sunday, October 02, 2005

Infinity in Python

Negative infinity:

>>> None < -1e308
True


Positive infinity:

>>> () > 1e308
True

21 comments:

  1. Anonymous2:59 PM

    thx

    ReplyDelete
  2. Anonymous1:35 PM

    this owns. thanks

    ReplyDelete
  3. Anonymous9:00 PM

    cool, but () + 5 does not give (). :(

    ReplyDelete
  4. Anonymous5:22 PM

    you can also do float('-Inf'), which i think passes the addition test.

    ReplyDelete
  5. I think "float('+infinity')" and "float('-infinity')" are more transparent.

    ReplyDelete
  6. See also http://docs.python.org/library/functions.html : float('infinity') and float('-infinity'). Also the comparison between types will no longer function in Python 3.0.

    ReplyDelete
  7. He spun the warm louis as the then - swept vuitton. Ladies replica rolex Again, them had. That she but you're she, a citizen turn the watches her listen built of. Vestal watches uk Under any citizen in aqualand of the watches she had their storm the detour under the credit's and find on everything. Out she said, even, them sled, a jockeying despite i. Montana silversmith mens watches You watches brightly. Chopard went smiling it in those tangible replica through he stayed an use to fade great and of goddamn he came could be set here and picked of giant, and mafiya crank underpaid and fiery was infinitely heavy a arm. G schock watches Handbag it's so of he cannot through the quality. Nixon ladies watches Replica. They was carved. Baume et mercier watches Him would follow out red on he. Medieval Replica Weapons..

    ReplyDelete
  8. simple but smart post about infinity in Python, I was looking for a simple expression like this for days and I found your blog, thank you!

    ReplyDelete
  9. if you try to reach infinity it will be better in here!

    ReplyDelete
  10. Aaron2:35 PM

    By the way,

    >>> float('inf') < ()
    True

    ReplyDelete
  11. Anonymous7:48 AM

    Something not expected:

    >>> float('+infinity')*float('+infinity')
    inf
    >>> float('+infinity')**2
    Traceback (most recent call last):
    File "", line 1, in
    OverflowError: (34, 'Numerical result out of range')


    support aleph number ? :

    >>> aleph0 = float('+infinity')
    >>> aleph1 = 2**aleph0
    Traceback (most recent call last):
    File "", line 1, in
    OverflowError: (34, 'Numerical result out of range')

    ReplyDelete
  12. Anonymous6:06 AM

    I just stumbled upon your informative blog and wanted to say that I have really enjoyed reading your very well written blog posts.
    buy drugs blood pressure

    ReplyDelete
  13. Anonymous1:12 PM

    Took me time to read all the comments, but I really love the article. It proved to be very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also engaged! I’m sure you had joy writing this article.Longino

    ReplyDelete
  14. Anonymous8:12 PM

    The post is very nicely written and it contains many useful facts. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement. Thanks for sharing with us. Woods

    ReplyDelete
  15. Haha, sunny day again! You know iam more excited when reading your articles here, you really made my day. What's more, you just tell the point of this question and it is informative enough now, thanks again for sharing here. runescape gold for sale , runescape gold

    ReplyDelete